java

关注公众号 jb51net

关闭
首页 > 软件编程 > java > dubbo启动报服务注册失败Failed to register dubbo

解决dubbo启动报服务注册失败Failed to register dubbo

作者:森林森

这篇文章主要介绍了解决dubbo启动报服务注册失败Failed to register dubbo问题,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教

dubbo 启动报 服务注册失败Failed to register dubbo

java.lang.IllegalStateException: Failed to register dubbo://192.168.187.1:20880/com.ghg.dubbo.api.GreetingService?anyhost=true&application=demo-provider&bean.name=com.ghg.dubbo.api.GreetingService&dubbo=2.0.2&generic=false&interface=com.ghg.dubbo.api.Gre

日志

Exception in thread "main" java.lang.IllegalStateException: Failed to register dubbo://192.168.187.1:20880/com.ghg.dubbo.api.GreetingService?anyhost=true&application=demo-provider&bean.name=com.ghg.dubbo.api.GreetingService&dubbo=2.0.2&generic=false&interface=com.ghg.dubbo.api.GreetingService&methods=sayHello&pid=9092&side=provider&timestamp=1545384997858 to registry 127.0.0.1:2181, cause: Failed to register dubbo://192.168.187.1:20880/com.ghg.dubbo.api.GreetingService?anyhost=true&application=demo-provider&bean.name=com.ghg.dubbo.api.GreetingService&dubbo=2.0.2&generic=false&interface=com.ghg.dubbo.api.GreetingService&methods=sayHello&pid=9092&side=provider&timestamp=1545384997858 to zookeeper zookeeper://127.0.0.1:2181/com.alibaba.dubbo.registry.RegistryService?application=demo-provider&dubbo=2.0.2&interface=com.alibaba.dubbo.registry.RegistryService&pid=9092&timestamp=1545384997854, cause: KeeperErrorCode = Unimplemented for /dubbo/com.ghg.dubbo.api.GreetingService/providers/dubbo%3A%2F%2F192.168.187.1%3A20880%2Fcom.ghg.dubbo.api.GreetingService%3Fanyhost%3Dtrue%26application%3Ddemo-provider%26bean.name%3Dcom.ghg.dubbo.api.GreetingService%26dubbo%3D2.0.2%26generic%3Dfalse%26interface%3Dcom.ghg.dubbo.api.GreetingService%26methods%3DsayHello%26pid%3D9092%26side%3Dprovider%26timestamp%3D1545384997858
   at com.alibaba.dubbo.registry.support.FailbackRegistry.register(FailbackRegistry.java:150)
   at com.alibaba.dubbo.registry.integration.RegistryProtocol.register(RegistryProtocol.java:126)
   at com.alibaba.dubbo.registry.integration.RegistryProtocol.export(RegistryProtocol.java:146)
   at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper.export(ProtocolFilterWrapper.java:98)
   at com.alibaba.dubbo.qos.protocol.QosProtocolWrapper.export(QosProtocolWrapper.java:60)
   at com.alibaba.dubbo.rpc.protocol.ProtocolListenerWrapper.export(ProtocolListenerWrapper.java:55)
   at com.alibaba.dubbo.rpc.Protocol$Adaptive.export(Protocol$Adaptive.java)
   at com.alibaba.dubbo.config.ServiceConfig.doExportUrlsFor1Protocol(ServiceConfig.java:513)
   at com.alibaba.dubbo.config.ServiceConfig.doExportUrls(ServiceConfig.java:358)
   at com.alibaba.dubbo.config.ServiceConfig.doExport(ServiceConfig.java:317)
   at com.alibaba.dubbo.config.ServiceConfig.export(ServiceConfig.java:216)
   at com.alibaba.dubbo.config.spring.ServiceBean.export(ServiceBean.java:291)
   at com.alibaba.dubbo.config.spring.ServiceBean.onApplicationEvent(ServiceBean.java:131)
   at com.alibaba.dubbo.config.spring.ServiceBean.onApplicationEvent(ServiceBean.java:53)
   at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
   at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
   at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
   at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:393)
   at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:347)
   at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:883)
   at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546)
   at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
   at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)
   at com.ghgcn.dubbo.Main.main(Main.java:11)
Caused by: com.alibaba.dubbo.rpc.RpcException: Failed to register dubbo://192.168.187.1:20880/com.ghg.dubbo.api.GreetingService?anyhost=true&application=demo-provider&bean.name=com.ghg.dubbo.api.GreetingService&dubbo=2.0.2&generic=false&interface=com.ghg.dubbo.api.GreetingService&methods=sayHello&pid=9092&side=provider&timestamp=1545384997858 to zookeeper zookeeper://127.0.0.1:2181/com.alibaba.dubbo.registry.RegistryService?application=demo-provider&dubbo=2.0.2&interface=com.alibaba.dubbo.registry.RegistryService&pid=9092&timestamp=1545384997854, cause: KeeperErrorCode = Unimplemented for /dubbo/com.ghg.dubbo.api.GreetingService/providers/dubbo%3A%2F%2F192.168.187.1%3A20880%2Fcom.ghg.dubbo.api.GreetingService%3Fanyhost%3Dtrue%26application%3Ddemo-provider%26bean.name%3Dcom.ghg.dubbo.api.GreetingService%26dubbo%3D2.0.2%26generic%3Dfalse%26interface%3Dcom.ghg.dubbo.api.GreetingService%26methods%3DsayHello%26pid%3D9092%26side%3Dprovider%26timestamp%3D1545384997858
   at com.alibaba.dubbo.registry.zookeeper.ZookeeperRegistry.doRegister(ZookeeperRegistry.java:116)
   at com.alibaba.dubbo.registry.support.FailbackRegistry.register(FailbackRegistry.java:137)
   ... 23 more
Caused by: java.lang.IllegalStateException: KeeperErrorCode = Unimplemented for /dubbo/com.ghg.dubbo.api.GreetingService/providers/dubbo%3A%2F%2F192.168.187.1%3A20880%2Fcom.ghg.dubbo.api.GreetingService%3Fanyhost%3Dtrue%26application%3Ddemo-provider%26bean.name%3Dcom.ghg.dubbo.api.GreetingService%26dubbo%3D2.0.2%26generic%3Dfalse%26interface%3Dcom.ghg.dubbo.api.GreetingService%26methods%3DsayHello%26pid%3D9092%26side%3Dprovider%26timestamp%3D1545384997858
   at com.alibaba.dubbo.remoting.zookeeper.curator.CuratorZookeeperClient.createEphemeral(CuratorZookeeperClient.java:89)
   at com.alibaba.dubbo.remoting.zookeeper.support.AbstractZookeeperClient.create(AbstractZookeeperClient.java:65)
   at com.alibaba.dubbo.registry.zookeeper.ZookeeperRegistry.doRegister(ZookeeperRegistry.java:114)
   ... 24 more
Caused by: org.apache.zookeeper.KeeperException$UnimplementedException: KeeperErrorCode = Unimplemented for /dubbo/com.ghg.dubbo.api.GreetingService/providers/dubbo%3A%2F%2F192.168.187.1%3A20880%2Fcom.ghg.dubbo.api.GreetingService%3Fanyhost%3Dtrue%26application%3Ddemo-provider%26bean.name%3Dcom.ghg.dubbo.api.GreetingService%26dubbo%3D2.0.2%26generic%3Dfalse%26interface%3Dcom.ghg.dubbo.api.GreetingService%26methods%3DsayHello%26pid%3D9092%26side%3Dprovider%26timestamp%3D1545384997858
   at org.apache.zookeeper.KeeperException.create(KeeperException.java:103)
   at org.apache.zookeeper.KeeperException.create(KeeperException.java:51)
   at org.apache.zookeeper.ZooKeeper.create(ZooKeeper.java:1525)
   at org.apache.curator.framework.imps.CreateBuilderImpl$17.call(CreateBuilderImpl.java:1181)
   at org.apache.curator.framework.imps.CreateBuilderImpl$17.call(CreateBuilderImpl.java:1158)
   at org.apache.curator.connection.StandardConnectionHandlingPolicy.callWithRetry(StandardConnectionHandlingPolicy.java:64)
   at org.apache.curator.RetryLoop.callWithRetry(RetryLoop.java:100)
   at org.apache.curator.framework.imps.CreateBuilderImpl.pathInForeground(CreateBuilderImpl.java:1155)
   at org.apache.curator.framework.imps.CreateBuilderImpl.protectedPathInForeground(CreateBuilderImpl.java:605)
   at org.apache.curator.framework.imps.CreateBuilderImpl.forPath(CreateBuilderImpl.java:595)
   at org.apache.curator.framework.imps.CreateBuilderImpl.forPath(CreateBuilderImpl.java:573)
   at org.apache.curator.framework.imps.CreateBuilderImpl.forPath(CreateBuilderImpl.java:49)
   at com.alibaba.dubbo.remoting.zookeeper.curator.CuratorZookeeperClient.createEphemeral(CuratorZookeeperClient.java:86)
   ... 26 more
2018-12-21 17:36:39 [main-EventThread] INFO  o.a.c.f.state.ConnectionStateManager -
               State change: SUSPENDED
2018-12-21 17:36:39 [DubboShutdownHook] DEBUG org.apache.curator.RetryLoop -
               Retry-able exception received
org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for /dubbo/com.ghg.dubbo.api.GreetingService/providers/dubbo%3A%2F%2F192.168.187.1%3A20880%2Fcom.ghg.dubbo.api.GreetingService%3Fanyhost%3Dtrue%26application%3Ddemo-provider%26bean.name%3Dcom.ghg.dubbo.api.GreetingService%26dubbo%3D2.0.2%26generic%3Dfalse%26interface%3Dcom.ghg.dubbo.api.GreetingService%26methods%3DsayHello%26pid%3D9092%26side%3Dprovider%26timestamp%3D1545384997858
   at org.apache.zookeeper.KeeperException.create(KeeperException.java:99)
   at org.apache.zookeeper.KeeperException.create(KeeperException.java:51)
   at org.apache.zookeeper.ZooKeeper.delete(ZooKeeper.java:1681)
   at org.apache.curator.framework.imps.DeleteBuilderImpl$5.call(DeleteBuilderImpl.java:274)
   at org.apache.curator.framework.imps.DeleteBuilderImpl$5.call(DeleteBuilderImpl.java:268)
   at org.apache.curator.connection.StandardConnectionHandlingPolicy.callWithRetry(StandardConnectionHandlingPolicy.java:64)
   at org.apache.curator.RetryLoop.callWithRetry(RetryLoop.java:100)
   at org.apache.curator.framework.imps.DeleteBuilderImpl.pathInForeground(DeleteBuilderImpl.java:265)
   at org.apache.curator.framework.imps.DeleteBuilderImpl.forPath(DeleteBuilderImpl.java:249)
   at org.apache.curator.framework.imps.DeleteBuilderImpl.forPath(DeleteBuilderImpl.java:34)
   at com.alibaba.dubbo.remoting.zookeeper.curator.CuratorZookeeperClient.delete(CuratorZookeeperClient.java:96)
   at com.alibaba.dubbo.registry.zookeeper.ZookeeperRegistry.doUnregister(ZookeeperRegistry.java:123)
   at com.alibaba.dubbo.registry.support.FailbackRegistry.unregister(FailbackRegistry.java:167)
   at com.alibaba.dubbo.registry.support.AbstractRegistry.destroy(AbstractRegistry.java:458)
   at com.alibaba.dubbo.registry.support.FailbackRegistry.destroy(FailbackRegistry.java:443)
   at com.alibaba.dubbo.registry.zookeeper.ZookeeperRegistry.destroy(ZookeeperRegistry.java:103)
   at com.alibaba.dubbo.registry.support.AbstractRegistryFactory.destroyAll(AbstractRegistryFactory.java:71)
   at com.alibaba.dubbo.config.DubboShutdownHook.destroyAll(DubboShutdownHook.java:69)
   at com.alibaba.dubbo.config.DubboShutdownHook.run(DubboShutdownHook.java:58)
2018-12-21 17:36:40 [DubboShutdownHook] DEBUG org.apache.curator.RetryLoop -
               Retrying operation
2018-12-21 17:36:40 [main-SendThread(127.0.0.1:2181)] INFO  org.apache.zookeeper.ClientCnxn -
               Opening socket connection to server 127.0.0.1/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)
2018-12-21 17:36:40 [main-SendThread(127.0.0.1:2181)] INFO  org.apache.zookeeper.ClientCnxn -
               Socket connection established, initiating session, client: /127.0.0.1:63688, server: 127.0.0.1/127.0.0.1:2181
2018-12-21 17:36:40 [main-SendThread(127.0.0.1:2181)] DEBUG org.apache.zookeeper.ClientCnxn -
               Session establishment request sent on 127.0.0.1/127.0.0.1:2181
2018-12-21 17:36:40 [main-SendThread(127.0.0.1:2181)] INFO  org.apache.zookeeper.ClientCnxn -
               Session establishment complete on server 127.0.0.1/127.0.0.1:2181, sessionid = 0x167cfc769cd0009, negotiated timeout = 40000
2018-12-21 17:36:40 [main-EventThread] DEBUG org.apache.curator.ConnectionState -
               Negotiated session timeout: 40000
2018-12-21 17:36:40 [main-EventThread] INFO  o.a.c.f.state.ConnectionStateManager -
               State change: RECONNECTED
2018-12-21 17:36:40 [main-EventThread] DEBUG o.a.c.f.imps.CuratorFrameworkImpl -
               Clearing sleep for 0 operations
2018-12-21 17:36:40 [main-SendThread(127.0.0.1:2181)] DEBUG org.apache.zookeeper.ClientCnxn -
               Reading reply sessionid:0x167cfc769cd0009, packet:: clientPath:null serverPath:null finished:false header:: 5,2  replyHeader:: 5,1070232,-101  request:: '/dubbo/com.ghg.dubbo.api.GreetingService/providers/dubbo%253A%252F%252F192.168.187.1%253A20880%252Fcom.ghg.dubbo.api.GreetingService%253Fanyhost%253Dtrue%2526application%253Ddemo-provider%2526bean.name%253Dcom.ghg.dubbo.api.GreetingService%2526dubbo%253D2.0.2%2526generic%253Dfalse%2526interface%253Dcom.ghg.dubbo.api.GreetingService%2526methods%253DsayHello%2526pid%253D9092%2526side%253Dprovider%2526timestamp%253D1545384997858,-1  response:: null
2018-12-21 17:36:40 [main-SendThread(127.0.0.1:2181)] DEBUG org.apache.zookeeper.ClientCnxn -
               Reading reply sessionid:0x167cfc769cd0009, packet:: clientPath:/zookeeper/config serverPath:/zookeeper/config finished:false header:: 6,4  replyHeader:: 6,1070232,-101  request:: '/zookeeper/config,T  response::  
2018-12-21 17:36:40 [DubboShutdownHook] DEBUG o.a.c.f.imps.CuratorFrameworkImpl -
               Closing
2018-12-21 17:36:40 [Curator-Framework-0] INFO  o.a.c.f.imps.CuratorFrameworkImpl -
               backgroundOperationsLoop exiting
2018-12-21 17:36:40 [DubboShutdownHook] DEBUG o.a.curator.CuratorZookeeperClient -
               Closing
2018-12-21 17:36:40 [DubboShutdownHook] DEBUG org.apache.curator.ConnectionState -
               Closing
2018-12-21 17:36:40 [DubboShutdownHook] DEBUG org.apache.zookeeper.ZooKeeper -
               Closing session: 0x167cfc769cd0009
2018-12-21 17:36:40 [DubboShutdownHook] DEBUG org.apache.zookeeper.ClientCnxn -
               Closing client for session: 0x167cfc769cd0009
2018-12-21 17:36:40 [main-SendThread(127.0.0.1:2181)] DEBUG org.apache.zookeeper.ClientCnxn -
               Reading reply sessionid:0x167cfc769cd0009, packet:: clientPath:null serverPath:null finished:false header:: 7,-11  replyHeader:: 7,1070233,0  request:: null response:: null
2018-12-21 17:36:40 [DubboShutdownHook] DEBUG org.apache.zookeeper.ClientCnxn -
               Disconnecting client for session: 0x167cfc769cd0009
2018-12-21 17:36:40 [DubboShutdownHook] INFO  org.apache.zookeeper.ZooKeeper -
               Session: 0x167cfc769cd0009 closed
2018-12-21 17:36:40 [main-EventThread] INFO  org.apache.zookeeper.ClientCnxn -
               EventThread shut down for session: 0x167cfc769cd0009

这里的问题主要是服务端的zookeeper版本和客户端的zookeeper版本不同。

我这里的zookeeper的服务端版本是3.4,客户端版本是3.5,然后就会导致各种各样的问题。

这里我们只要降低一下curator-framework的版本就可以了,

<version.curator>2.12.0</version.curator>
<dependency>
			<groupId>org.apache.curator</groupId>
			<artifactId>curator-framework</artifactId>
			<version>${version.curator}</version>
		</dependency>

最终启动成功!

总结

以上为个人经验,希望能给大家一个参考,也希望大家多多支持脚本之家。

您可能感兴趣的文章:
阅读全文