【springboot 整合 dubbo 报错 】 | IT修真院·坑乎
咨询电话 : 010-59478634
切换导航
首页
我的提问
我的回答
我的点赞
消息通知
个人主页
×
提示
尚未登陆,前往官网登陆?
×
提示
尚未登陆,前往官网登陆?
springboot 整合 dubbo 报错
我也踩过这个坑(
1
)
已统计您的踩坑,无需重复点击
回答(0)
详细描述
利用 springboot-dubbo 快速启动依赖 去整合 springboot和dubbo ,服务提供者 能正常启动,但是 服务消费者在启动时 报错,无法创建 bean ,原因是 无法连接到 对应的 服务
源码
// 服务端 采用 ali @Service 注册服务 @Service @Component public class HelloServiceImpl implements IHelloService { @Override public String sayHello(String name) { return "hello " + name + "/n"+"==== Springboot + dubbo ===="; } } // 客户端 利用 ali 的 @Reference 注入 接口 ,消费服务 @Controller public class HelloController { @Reference private IHelloService iHelloService; @GetMapping public String sayHi(String name){ return iHelloService.sayHello(name); } }
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'helloServiceDemo' defined in file [D:\workspace\dubbo\customer\target\classes\com\jnshu\customer\service\HelloServiceDemo.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: helloServiceDemo; nested exception is java.lang.IllegalStateException: Failed to check the status of the service com.jnshu.customer.service.IHelloService. No provider available for the service com.jnshu.customer.service.IHelloService from the url zookeeper://127.0.0.1:2181/com.alibaba.dubbo.registry.RegistryService?application=youth-dubbo-consumer&dubbo=2.6.0&interface=com.jnshu.customer.service.IHelloService&methods=sayHello&pid=1328®ister.ip=192.168.23.1&side=consumer×tamp=1535708707120 to the consumer 192.168.23.1 use dubbo version 2.6.0 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:581) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:495) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:759) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:869) ~[spring-context-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) ~[spring-boot-2.0.4.RELEASE.jar:2.0.4.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:762) [spring-boot-2.0.4.RELEASE.jar:2.0.4.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:398) [spring-boot-2.0.4.RELEASE.jar:2.0.4.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:330) [spring-boot-2.0.4.RELEASE.jar:2.0.4.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1258) [spring-boot-2.0.4.RELEASE.jar:2.0.4.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1246) [spring-boot-2.0.4.RELEASE.jar:2.0.4.RELEASE] at com.jnshu.customer.CustomerApplication.main(CustomerApplication.java:12) [classes/:na] Caused by: org.springframework.beans.factory.BeanCreationException: helloServiceDemo; nested exception is java.lang.IllegalStateException: Failed to check the status of the service com.jnshu.customer.service.IHelloService. No provider available for the service com.jnshu.customer.service.IHelloService from the url zookeeper://127.0.0.1:2181/com.alibaba.dubbo.registry.RegistryService?application=youth-dubbo-consumer&dubbo=2.6.0&interface=com.jnshu.customer.service.IHelloService&methods=sayHello&pid=1328®ister.ip=192.168.23.1&side=consumer×tamp=1535708707120 to the consumer 192.168.23.1 use dubbo version 2.6.0 at com.alibaba.dubbo.spring.boot.DubboConsumerAutoConfiguration$1.postProcessBeforeInitialization(DubboConsumerAutoConfiguration.java:100) ~[dubbo-spring-boot-starter-2.0.0.jar:na] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:416) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1691) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:573) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] ... 15 common frames omitted Caused by: java.lang.IllegalStateException: Failed to check the status of the service com.jnshu.customer.service.IHelloService. No provider available for the service com.jnshu.customer.service.IHelloService from the url zookeeper://127.0.0.1:2181/com.alibaba.dubbo.registry.RegistryService?application=youth-dubbo-consumer&dubbo=2.6.0&interface=com.jnshu.customer.service.IHelloService&methods=sayHello&pid=1328®ister.ip=192.168.23.1&side=consumer×tamp=1535708707120 to the consumer 192.168.23.1 use dubbo version 2.6.0 at com.alibaba.dubbo.config.ReferenceConfig.createProxy(ReferenceConfig.java:422) ~[dubbo-2.6.0.jar:2.6.0] at com.alibaba.dubbo.config.ReferenceConfig.init(ReferenceConfig.java:333) ~[dubbo-2.6.0.jar:2.6.0] at com.alibaba.dubbo.config.ReferenceConfig.get(ReferenceConfig.java:163) ~[dubbo-2.6.0.jar:2.6.0] at com.alibaba.dubbo.config.spring.ReferenceBean.getObject(ReferenceBean.java:59) ~[dubbo-2.6.0.jar:2.6.0] at com.alibaba.dubbo.spring.boot.DubboConsumerAutoConfiguration$1.postProcessBeforeInitialization(DubboConsumerAutoConfiguration.java:89) ~[dubbo-spring-boot-starter-2.0.0.jar:na] ... 18 common frames omitted
编辑于2025-04-20
Copyright ©2015 北京葡萄藤信息技术有限公司 All Rights Reserved | 京ICP备15035574号-1
复制链接
新浪微博
微信扫一扫
2613
0
10
springboot 整合 dubbo 报错
0
1