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

 更新时间:2023年12月02日 09:58:49   作者:森林森  
这篇文章主要介绍了解决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>

最终启动成功!

总结

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

相关文章

  • Spring调度框架EnableScheduling&Scheduled源码解析

    Spring调度框架EnableScheduling&Scheduled源码解析

    这篇文章主要介绍了Spring调度框架EnableScheduling&Scheduled源码解析,@EnableScheduling&Scheduled定时调度框架,本着不仅知其然还要知其所以然的指导思想,下面对该调度框架进行源码解析,以便更好的理解其执行过程,需要的朋友可以参考下
    2024-01-01
  • Mybatis懒加载的实现

    Mybatis懒加载的实现

    这篇文章主要介绍了Mybatis懒加载的实现,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
    2020-07-07
  • Java的HashMap源码解析

    Java的HashMap源码解析

    这篇文章主要介绍了Java的HashMap源码解析,HashMap是一个用于存储Key-Value键值对的集合,每一个键值对是一个Node,后台是用一个Node数组来存放数据,这个Node数组就是HashMap的主干,需要的朋友可以参考下
    2023-11-11
  • Servlet 过滤器详细介绍

    Servlet 过滤器详细介绍

    这篇文章介绍了Servlet 过滤器,有需要的朋友可以参考一下
    2013-10-10
  • spring缓存自定义resolver的方法

    spring缓存自定义resolver的方法

    这篇文章主要为大家详细介绍了spring缓存自定义resolver的方法,文中示例代码介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下,希望能够给你带来帮助
    2022-03-03
  • Java中的参数传递详细介绍

    Java中的参数传递详细介绍

    大家好,本篇文章主要讲的是Java中的参数传递详解,感兴趣的同学赶快来看一看吧,对你有帮助的话记得收藏一下,方便下次浏览
    2022-01-01
  • Spring Security新版本实现权限认证与授权

    Spring Security新版本实现权限认证与授权

    Spring Security 是一个开源的安全框架,提供了基于权限的访问控制、身份认证的功能,本文主要介绍了Spring Security新版本实现权限认证与授权,具有一定参考价值,感兴趣的可以了解一下
    2024-04-04
  • Springboot使用slf4j记录日志的方法步骤

    Springboot使用slf4j记录日志的方法步骤

    本文主要介绍了Springboot使用slf4j记录日志的方法步骤,文中通过示例代码介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
    2022-01-01
  • mybatis调用mysql存储过程(返回参数,单结果集,多结果集)

    mybatis调用mysql存储过程(返回参数,单结果集,多结果集)

    本文主要介绍了mybatis调用mysql存储过程(返回参数,单结果集,多结果集),文中通过示例代码介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
    2022-01-01
  • MyBatis saveBatch 性能调优的实现

    MyBatis saveBatch 性能调优的实现

    本文主要介绍了MyBatis saveBatch 性能调优的实现,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
    2023-07-07

最新评论