dubbo注册到zookeeper,项目启动爆如下2种错误?

dubbo版本2.5.4
启动的时候报两种错
错误1

2023-02-24 13:12:35.748 [main] WARN  
o.s.b.factory.support.DefaultListableBeanFactory -
 Bean creation exception on non-lazy FactoryBean type check: 
 org.springframework.beans.factory.BeanCreationException:
 Error creating bean with name 'fileServiceClient': 
 Invocation of init method failed;
 nested exception is java.lang.IllegalStateException: 
 No such application config! Please add <dubbo:application name="..." /> to your spring config.

错误2

2023-02-24 13:12:35.748 [main] WARN  
o.s.b.factory.support.DefaultListableBeanFactory -
 Bean creation exception on non-lazy FactoryBean type check: 
 org.springframework.beans.factory.BeanCreationException:
 Error creating bean with name 'fileServiceClient': 
 Invocation of init method failed;
 nested exception is java.lang.IllegalStateException: 
 No such application config! Please add <dubbo:application name="..." /> to your spring config.
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
    http://code.alibabatech.com/schema/dubbo
    http://code.alibabatech.com/schema/dubbo/dubbo.xsd">

    <dubbo:registry id="qingdaoRegistryDTS" protocol="zookeeper" address="10.15.7.56:2181,10.15.7.58:2181,10.15.6.66:2181" timeout="60000"/>
    <!-- 操作指导下载图片,视频等-->
    <dubbo:reference id="fileServiceClient"  registry="qingdaoRegistryDTS" interface="com.openplatform.hfs.client.service.FileServiceClient"  version="1.0.0"  protocol="dubbo" timeout="100000"  check="false" init="true" />
    <dubbo:reference id="fileCRUDServiceClient"  registry="qingdaoRegistryDTS"  interface="com.openplatform.hfs.client.service.FileCRUDServiceClient" version="1.0.0"  protocol="dubbo" timeout="100000"  check="false" init="true" />

</beans>
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
    xsi:schemaLocation="
        http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans.xsd
        http://code.alibabatech.com/schema/dubbo
        http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
    <dubbo:reference retries="0"
        interface="com.haier.cosmo.base.auth.user.service.IUserService" id="userService"
        check="false" timeout="10000" version="${dubboProps.mapProps.authVersion:1.0}" />

</beans>

yml配置如下

spring:
  dubbo:
    application:
      name: base-prod
      logger: slf4j
    registry:
      id: RegistryHLHT
      protocol: zookeeper
      address: 10.163.6.11:2181
    protocol:
      name: dubbo
      port: -1
    user:
      version:base-prod

dubboProps:
  mapProps:
    authVersion: auth-base-prod
阅读 2.1k
1 个回答
新手上路,请多包涵

根据错误:通过工厂bean去创建半成品时,但是bean的名称没找到。

解决:你的服务名呢,没看到你在xml里面配置,看下你的yml有没有写。
还有一个原因可能和版本兼容性有关,贴下你的duboo版本,我现在用的是2.7.21

推荐问题