Spring Boot 第一次配置 Dubbo 就报错,不知道怎么解决

2019-08-05 11:39:30 +08:00
 JYChiu
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-08-05 11:30:08.462 ERROR 4435 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'quickStartConsumer' defined in file [/Users/chiu/Documents/IdeaProjects/springboot_dubbo_zk/consumer/target/classes/com/xxx/consumer/QuickStart/QuickStartConsumer.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: quickStartConsumer; nested exception is com.alibaba.dubbo.rpc.RpcException: Fail to create remoting client for service(dubbo://127.0.0.1:20880/com.xxx.ServiceAPI?application=the-consumer&codec=dubbo&dubbo=2.6.0&heartbeat=60000&interface=com.xxx.ServiceAPI&methods=sendMessage&pid=4435&register.ip=192.168.124.4&side=consumer&timestamp=1564975808256): client(url: dubbo://127.0.0.1:20880/com.xxx.ServiceAPI?application=the-consumer&codec=dubbo&dubbo=2.6.0&heartbeat=60000&interface=com.xxx.ServiceAPI&methods=sendMessage&pid=4435&register.ip=192.168.124.4&side=consumer&timestamp=1564975808256) failed to connect to server /127.0.0.1:20880, error message is:Connection refused
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:601) ~[spring-beans-5.1.8.RELEASE.jar:5.1.8.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) ~[spring-beans-5.1.8.RELEASE.jar:5.1.8.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.8.RELEASE.jar:5.1.8.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.8.RELEASE.jar:5.1.8.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.8.RELEASE.jar:5.1.8.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.8.RELEASE.jar:5.1.8.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:845) ~[spring-beans-5.1.8.RELEASE.jar:5.1.8.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877) ~[spring-context-5.1.8.RELEASE.jar:5.1.8.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) ~[spring-context-5.1.8.RELEASE.jar:5.1.8.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) ~[spring-boot-2.1.6.RELEASE.jar:2.1.6.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:742) [spring-boot-2.1.6.RELEASE.jar:2.1.6.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:389) [spring-boot-2.1.6.RELEASE.jar:2.1.6.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:311) [spring-boot-2.1.6.RELEASE.jar:2.1.6.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1213) [spring-boot-2.1.6.RELEASE.jar:2.1.6.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1202) [spring-boot-2.1.6.RELEASE.jar:2.1.6.RELEASE]
    at com.xxx.consumer.ConsumerApp.main(ConsumerApp.java:15) [classes/:na]
Caused by: org.springframework.beans.factory.BeanCreationException: quickStartConsumer; nested exception is com.alibaba.dubbo.rpc.RpcException: Fail to create remoting client for service(dubbo://127.0.0.1:20880/com.xxx.ServiceAPI?application=the-consumer&codec=dubbo&dubbo=2.6.0&heartbeat=60000&interface=com.xxx.ServiceAPI&methods=sendMessage&pid=4435&register.ip=192.168.124.4&side=consumer&timestamp=1564975808256): client(url: dubbo://127.0.0.1:20880/com.xxx.ServiceAPI?application=the-consumer&codec=dubbo&dubbo=2.6.0&heartbeat=60000&interface=com.xxx.ServiceAPI&methods=sendMessage&pid=4435&register.ip=192.168.124.4&side=consumer&timestamp=1564975808256) failed to connect to server /127.0.0.1:20880, error message is:Connection refused
    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:414) ~[spring-beans-5.1.8.RELEASE.jar:5.1.8.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1770) ~[spring-beans-5.1.8.RELEASE.jar:5.1.8.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593) ~[spring-beans-5.1.8.RELEASE.jar:5.1.8.RELEASE]
    ... 15 common frames omitted
Caused by: com.alibaba.dubbo.rpc.RpcException: Fail to create remoting client for service(dubbo://127.0.0.1:20880/com.xxx.ServiceAPI?application=the-consumer&codec=dubbo&dubbo=2.6.0&heartbeat=60000&interface=com.xxx.ServiceAPI&methods=sendMessage&pid=4435&register.ip=192.168.124.4&side=consumer&timestamp=1564975808256): client(url: dubbo://127.0.0.1:20880/com.xxx.ServiceAPI?application=the-consumer&codec=dubbo&dubbo=2.6.0&heartbeat=60000&interface=com.xxx.ServiceAPI&methods=sendMessage&pid=4435&register.ip=192.168.124.4&side=consumer&timestamp=1564975808256) failed to connect to server /127.0.0.1:20880, error message is:Connection refused
    at com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol.initClient(DubboProtocol.java:404) ~[dubbo-2.6.0.jar:2.6.0]
    at com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol.getSharedClient(DubboProtocol.java:367) ~[dubbo-2.6.0.jar:2.6.0]
    at com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol.getClients(DubboProtocol.java:344) ~[dubbo-2.6.0.jar:2.6.0]
    at com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol.refer(DubboProtocol.java:326) ~[dubbo-2.6.0.jar:2.6.0]
    at com.alibaba.dubbo.rpc.protocol.ProtocolListenerWrapper.refer(ProtocolListenerWrapper.java:77) ~[dubbo-2.6.0.jar:2.6.0]
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper.refer(ProtocolFilterWrapper.java:100) ~[dubbo-2.6.0.jar:2.6.0]
    at com.alibaba.dubbo.rpc.Protocol$Adaptive.refer(Protocol$Adaptive.java) ~[dubbo-2.6.0.jar:2.6.0]
    at com.alibaba.dubbo.config.ReferenceConfig.createProxy(ReferenceConfig.java:394) ~[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
Caused by: com.alibaba.dubbo.remoting.RemotingException: client(url: dubbo://127.0.0.1:20880/com.xxx.ServiceAPI?application=the-consumer&codec=dubbo&dubbo=2.6.0&heartbeat=60000&interface=com.xxx.ServiceAPI&methods=sendMessage&pid=4435&register.ip=192.168.124.4&side=consumer&timestamp=1564975808256) failed to connect to server /127.0.0.1:20880, error message is:Connection refused
    at com.alibaba.dubbo.remoting.transport.netty.NettyClient.doConnect(NettyClient.java:122) ~[dubbo-2.6.0.jar:2.6.0]
    at com.alibaba.dubbo.remoting.transport.AbstractClient.connect(AbstractClient.java:266) ~[dubbo-2.6.0.jar:2.6.0]
    at com.alibaba.dubbo.remoting.transport.AbstractClient.<init>(AbstractClient.java:89) ~[dubbo-2.6.0.jar:2.6.0]
    at com.alibaba.dubbo.remoting.transport.netty.NettyClient.<init>(NettyClient.java:59) ~[dubbo-2.6.0.jar:2.6.0]
    at com.alibaba.dubbo.remoting.transport.netty.NettyTransporter.connect(NettyTransporter.java:35) ~[dubbo-2.6.0.jar:2.6.0]
    at com.alibaba.dubbo.remoting.Transporter$Adaptive.connect(Transporter$Adaptive.java) ~[dubbo-2.6.0.jar:2.6.0]
    at com.alibaba.dubbo.remoting.Transporters.connect(Transporters.java:75) ~[dubbo-2.6.0.jar:2.6.0]
    at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchanger.connect(HeaderExchanger.java:38) ~[dubbo-2.6.0.jar:2.6.0]
    at com.alibaba.dubbo.remoting.exchange.Exchangers.connect(Exchangers.java:109) ~[dubbo-2.6.0.jar:2.6.0]
    at com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol.initClient(DubboProtocol.java:401) ~[dubbo-2.6.0.jar:2.6.0]
    ... 29 common frames omitted
Caused by: java.net.ConnectException: Connection refused
    at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) ~[na:1.8.0_131]
    at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717) ~[na:1.8.0_131]
    at org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink$Boss.connect(NioClientSocketPipelineSink.java:384) ~[netty-3.2.5.Final.jar:na]
    at org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink$Boss.processSelectedKeys(NioClientSocketPipelineSink.java:354) ~[netty-3.2.5.Final.jar:na]
    at org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink$Boss.run(NioClientSocketPipelineSink.java:276) ~[netty-3.2.5.Final.jar:na]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[na:1.8.0_131]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[na:1.8.0_131]
    at java.lang.Thread.run(Thread.java:748) ~[na:1.8.0_131]

没有配置 ZooKeeper,纯粹是 Dubbo 的问题。

3128 次点击
所在节点   2019
0 条回复

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/589137

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX