1. 程式人生 > >Dubbo啟動報錯

Dubbo啟動報錯

異常關鍵字:

  • ERROR com.alibaba.dubbo.remoting.transport.AbstractClient - [DUBBO] Failed to start NettyClient
  • com.alibaba.dubbo.remoting.RemotingException: client
  • at com.alibaba.dubbo.remoting.transport.netty.NettyClient.doConnect(NettyClient.java:127)
  • client-side timeout 3000ms (elapsed: 3002ms) from netty client 10.0.0.3 using dubbo version 2.5.3

最近在寫一個demo,使用到dubbo服務,在公司測試demo執行是沒有問題的,下班的時候專案服務沒有停,直接電腦鎖屏就回家了,然後晚上回到家再次測試的時候,demo啟動報錯,出現了error,但是不影響專案的執行,因為是初學dubbo,沒有踩過這個坑,困擾了我幾個小時,記錄下

異常資訊:

23:31:40.962 [RMI TCP Connection(3)-127.0.0.1] ERROR com.alibaba.dubbo.remoting.transport.AbstractClient -  [DUBBO] Failed to start NettyClient XPS-13
/10.0.0.3 connect to the server /10.63.73.141:20880 (check == false, ignore and retry later!), cause: client(url: dubbo://10.63.73.141:20880/com.ryan.service.StudentDubboService?anyhost=true&application=dubbo&check=false&codec=dubbo&connections=1&dubbo=2.5.3&heartbeat=60000&interface=com.ryan
.service.StudentDubboService&logger=slf4j&methods=findStudentInfoByStuId,insertStudent,deleteStudentByStuId,findStudentListByPage,updateStudentByStuId&payload=51557050&pid=19596&retries=0&revision=1.0-SNAPSHOT&side=consumer&timeout=60000&timestamp=1527607895642&version=1.0.0) failed to connect to server /10.63.73.141:20880 client-side timeout 3000ms (elapsed: 3002ms) from netty client 10.0.0.3 using dubbo version 2.5.3, dubbo version: 2.5.3, current host: 10.0.0.3 com.alibaba.dubbo.remoting.RemotingException: client(url: dubbo://10.63.73.141:20880/com.ryan.service.StudentDubboService?anyhost=true&application=dubbo&check=false&codec=dubbo&connections=1&dubbo=2.5.3&heartbeat=60000&interface=com.ryan.service.StudentDubboService&logger=slf4j&methods=findStudentInfoByStuId,insertStudent,deleteStudentByStuId,findStudentListByPage,updateStudentByStuId&payload=51557050&pid=19596&retries=0&revision=1.0-SNAPSHOT&side=consumer&timeout=60000&timestamp=1527607895642&version=1.0.0) failed to connect to server /10.63.73.141:20880 client-side timeout 3000ms (elapsed: 3002ms) from netty client 10.0.0.3 using dubbo version 2.5.3 at com.alibaba.dubbo.remoting.transport.netty.NettyClient.doConnect(NettyClient.java:127) ~[dubbo-2.5.3.jar:2.5.3] at com.alibaba.dubbo.remoting.transport.AbstractClient.connect(AbstractClient.java:280) ~[dubbo-2.5.3.jar:2.5.3] at com.alibaba.dubbo.remoting.transport.AbstractClient.<init>(AbstractClient.java:103) ~[dubbo-2.5.3.jar:2.5.3] at com.alibaba.dubbo.remoting.transport.netty.NettyClient.<init>(NettyClient.java:61) ~[dubbo-2.5.3.jar:2.5.3] at com.alibaba.dubbo.remoting.transport.netty.NettyTransporter.connect(NettyTransporter.java:37) ~[dubbo-2.5.3.jar:2.5.3] at com.alibaba.dubbo.remoting.Transporter$Adpative.connect(Transporter$Adpative.java) ~[?:2.5.3] at com.alibaba.dubbo.remoting.Transporters.connect(Transporters.java:67) ~[dubbo-2.5.3.jar:2.5.3] at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchanger.connect(HeaderExchanger.java:37) ~[dubbo-2.5.3.jar:2.5.3] at com.alibaba.dubbo.remoting.exchange.Exchangers.connect(Exchangers.java:102) ~[dubbo-2.5.3.jar:2.5.3] at com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol.initClient(DubboProtocol.java:378) ~[dubbo-2.5.3.jar:2.5.3] at com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol.getClients(DubboProtocol.java:323) ~[dubbo-2.5.3.jar:2.5.3] at com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol.refer(DubboProtocol.java:303) ~[dubbo-2.5.3.jar:2.5.3] at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper.refer(ProtocolFilterWrapper.java:62) ~[dubbo-2.5.3.jar:2.5.3] at com.alibaba.dubbo.rpc.protocol.ProtocolListenerWrapper.refer(ProtocolListenerWrapper.java:65) ~[dubbo-2.5.3.jar:2.5.3] at com.alibaba.dubbo.rpc.Protocol$Adpative.refer(Protocol$Adpative.java) ~[?:2.5.3] at com.alibaba.dubbo.registry.integration.RegistryDirectory.toInvokers(RegistryDirectory.java:395) ~[dubbo-2.5.3.jar:2.5.3] at com.alibaba.dubbo.registry.integration.RegistryDirectory.refreshInvoker(RegistryDirectory.java:224) ~[dubbo-2.5.3.jar:2.5.3] at com.alibaba.dubbo.registry.integration.RegistryDirectory.notify(RegistryDirectory.java:195) ~[dubbo-2.5.3.jar:2.5.3] at com.alibaba.dubbo.registry.support.AbstractRegistry.notify(AbstractRegistry.java:449) ~[dubbo-2.5.3.jar:2.5.3] at com.alibaba.dubbo.registry.support.FailbackRegistry.doNotify(FailbackRegistry.java:273) ~[dubbo-2.5.3.jar:2.5.3] at com.alibaba.dubbo.registry.support.FailbackRegistry.notify(FailbackRegistry.java:259) ~[dubbo-2.5.3.jar:2.5.3] at com.alibaba.dubbo.registry.zookeeper.ZookeeperRegistry.doSubscribe(ZookeeperRegistry.java:170) ~[dubbo-2.5.3.jar:2.5.3] at com.alibaba.dubbo.registry.support.FailbackRegistry.subscribe(FailbackRegistry.java:189) ~[dubbo-2.5.3.jar:2.5.3] at com.alibaba.dubbo.registry.integration.RegistryDirectory.subscribe(RegistryDirectory.java:133) ~[dubbo-2.5.3.jar:2.5.3] at com.alibaba.dubbo.registry.integration.RegistryProtocol.doRefer(RegistryProtocol.java:271) ~[dubbo-2.5.3.jar:2.5.3] at com.alibaba.dubbo.registry.integration.RegistryProtocol.refer(RegistryProtocol.java:254) ~[dubbo-2.5.3.jar:2.5.3] at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper.refer(ProtocolFilterWrapper.java:60) ~[dubbo-2.5.3.jar:2.5.3] at com.alibaba.dubbo.rpc.protocol.ProtocolListenerWrapper.refer(ProtocolListenerWrapper.java:63) ~[dubbo-2.5.3.jar:2.5.3] at com.alibaba.dubbo.rpc.Protocol$Adpative.refer(Protocol$Adpative.java) ~[?:2.5.3] at com.alibaba.dubbo.config.ReferenceConfig.createProxy(ReferenceConfig.java:392) ~[dubbo-2.5.3.jar:2.5.3] at com.alibaba.dubbo.config.ReferenceConfig.init(ReferenceConfig.java:300) ~[dubbo-2.5.3.jar:2.5.3] at com.alibaba.dubbo.config.ReferenceConfig.get(ReferenceConfig.java:138) ~[dubbo-2.5.3.jar:2.5.3] at com.alibaba.dubbo.config.spring.ReferenceBean.getObject(ReferenceBean.java:65) ~[dubbo-2.5.3.jar:2.5.3] at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:168) ~[spring-beans-4.1.5.RELEASE.jar:4.1.5.RELEASE] at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:103) ~[spring-beans-4.1.5.RELEASE.jar:4.1.5.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1517) ~[spring-beans-4.1.5.RELEASE.jar:4.1.5.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:251) ~[spring-beans-4.1.5.RELEASE.jar:4.1.5.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) ~[spring-beans-4.1.5.RELEASE.jar:4.1.5.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1120) ~[spring-beans-4.1.5.RELEASE.jar:4.1.5.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1044) ~[spring-beans-4.1.5.RELEASE.jar:4.1.5.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:942) ~[spring-beans-4.1.5.RELEASE.jar:4.1.5.RELEASE] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:533) ~[spring-beans-4.1.5.RELEASE.jar:4.1.5.RELEASE] at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88) ~[spring-beans-4.1.5.RELEASE.jar:4.1.5.RELEASE] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331) ~[spring-beans-4.1.5.RELEASE.jar:4.1.5.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1202) ~[spring-beans-4.1.5.RELEASE.jar:4.1.5.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537) ~[spring-beans-4.1.5.RELEASE.jar:4.1.5.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476) ~[spring-beans-4.1.5.RELEASE.jar:4.1.5.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303) ~[spring-beans-4.1.5.RELEASE.jar:4.1.5.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.1.5.RELEASE.jar:4.1.5.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299) ~[spring-beans-4.1.5.RELEASE.jar:4.1.5.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) ~[spring-beans-4.1.5.RELEASE.jar:4.1.5.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:755) ~[spring-beans-4.1.5.RELEASE.jar:4.1.5.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757) ~[spring-context-4.1.5.RELEASE.jar:4.1.5.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480) ~[spring-context-4.1.5.RELEASE.jar:4.1.5.RELEASE] at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403) ~[spring-web-4.1.5.RELEASE.jar:4.1.5.RELEASE] at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306) ~[spring-web-4.1.5.RELEASE.jar:4.1.5.RELEASE] at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106) ~[spring-web-4.1.5.RELEASE.jar:4.1.5.RELEASE] at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4853) ~[catalina.jar:8.0.47] at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5314) ~[catalina.jar:8.0.47] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) ~[catalina.jar:8.0.47] at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:753) ~[catalina.jar:8.0.47] at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:729) ~[catalina.jar:8.0.47] at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717) ~[catalina.jar:8.0.47] at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1733) ~[catalina.jar:8.0.47] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_144] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_144] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_144] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_144] at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300) ~[tomcat-coyote.jar:8.0.47] at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) ~[?:1.8.0_144] at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) ~[?:1.8.0_144] at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:484) ~[catalina.jar:8.0.47] at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:433) ~[catalina.jar:8.0.47] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_144] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_144] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_144] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_144] at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300) ~[tomcat-coyote.jar:8.0.47] at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) ~[?:1.8.0_144] at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) ~[?:1.8.0_144] at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1468) ~[?:1.8.0_144] at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76) ~[?:1.8.0_144] at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1309) ~[?:1.8.0_144] at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1401) ~[?:1.8.0_144] at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:829) ~[?:1.8.0_144] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_144] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_144] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_144] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_144] at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:357) ~[?:1.8.0_144] at sun.rmi.transport.Transport$1.run(Transport.java:200) ~[?:1.8.0_144] at sun.rmi.transport.Transport$1.run(Transport.java:197) ~[?:1.8.0_144] at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_144] at sun.rmi.transport.Transport.serviceCall(Transport.java:196) ~[?:1.8.0_144] at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568) ~[?:1.8.0_144] at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826) ~[?:1.8.0_144] at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:683) ~[?:1.8.0_144] at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_144] at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682) [?:1.8.0_144] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_144] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_144] at java.lang.Thread.run(Thread.java:748) [?:1.8.0_144] [2018-05-29 11:31:43,755] Artifact doorstore-web:war exploded: Artifact is deployed successfully [2018-05-29 11:31:43,755] Artifact doorstore-web:war exploded: Deploy took 26,723 milliseconds

問題解決

1、之前發牢騷的時候已經講過,這個demo在公司執行沒有問題,下班的時候沒有關閉demo,即dubbo服務正常註冊
2、dubbo註冊中心(zookeeper)用的是公網地址
3、在家執行demo,啟動dubbo報錯,但專案能正常啟動、dubbo服務正常註冊,而且demo能正常執行,絲毫不受報錯資訊的影響

圖為dubbo-admin中的資訊截圖

提供者資訊

消費者資訊

找了很多資料,最終發現是因為dubbo消費者無法連線到生產者提供的服務(內網IP ??),如上圖,兩個提供者消費者,兩個IP都為路由器分配的內網IP,即消費者在尋找提供者的時候,其中一個提供者地址不具有可連通性,這個內網是不具有可達性的,所以找不到服務的提供者,導致最終報錯,所以問題的根源不在dubbo的配置上,只需要處於同一網路環境下,那麼就能避免這個問題