1
回答
springboot+dubbo 提供者 未启动 消费者 启动报错

最近刚开始接触dubbo,于是自己搭建了一个spring boot+dubbo 的项目,相关细节不是太熟悉,过程中遇到了几个问题,

 

直接说问题:错误如下

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userControllet': Unsatisfied dependency expressed through field 'userIntegration'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userIntegration' defined in file [E:\Documents\project\idea-git\dubbodemo\userdemo\user-service\target\classes\org\song\rpc\dubbo\integration\UserIntegration.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanInitializationException: Failed to init remote service reference at filed bookResource in class org.song.rpc.dubbo.integration.UserIntegration; nested exception is java.lang.IllegalStateException: Failed to check the status of the service org.song.rpc.dubbo.resource.BookResource. No provider available for the service org.song.rpc.dubbo.resource.BookResource:1.0.0 from the url zookeeper://127.0.0.1:2181/com.alibaba.dubbo.registry.RegistryService?application=dubbo-user&default.loadbalance=roundrobin&dubbo=2.8.4&interface=org.song.rpc.dubbo.resource.BookResource&methods=getAllBooks&pid=11760&revision=1.0.0&side=consumer&timestamp=1503911603298&version=1.0.0 to the consumer 10.100.142.104 use dubbo version 2.8.4


 

  • springboot 1.5.6
  • dubbo
  • zookeeper
  • mybatis+mysql  这个可以忽略

项目目录结构

 

这里的userdemo和bookdemo相互是提供者和消费者,

只要启动无论哪一个,都会报错如上,springboot启动失败,这时候我将消费注释掉

//    @Reference(version = "1.0.0", consumer = "defaultConsumer")
//    private UserResource userResource;
//
//    public List<UserDTO> getUsers(){
//        return userResource.getAllUsers();
//    }

启动就成功了,这时候再启动另一个,也成功了。

问题:

是不是缺少什么配置?让服务启动的时候,即使没有提供者也不会报错,等提供者启动完成然后在建立关系?

举报
noseew
发帖于1年前 1回/1K+阅
顶部