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

java.lang.IllegalStateException: Failed to register dubbo://192.168.187.1:20880/com.ghg.dubbo.api.GreetingServiceanyhost=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>

最终启动成功

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
服务消费者调用失败可能有多种原因,具体需要根据你的具体情况来分析。以下是一些可能导致服务消费者调用失败的常见问题和解决方法: 1. 检查服务提供者是否已经成功注册到 ZooKeeper。你可以使用 ZooKeeper 的命令行工具或可视化工具来检查服务提供者是否已经成功注册。如果服务提供者没有成功注册,那么服务消费者将无法找到该服务,调用也会失败。 2. 检查服务消费者是否正确引用了服务提供者的接口。服务消费者在调用服务提供者时,需要正确引用服务提供者的接口,否则将无法调用成功。你可以检查服务消费者代码中引用服务提供者接口的地方,确保其与服务提供者的接口一致。 3. 检查服务消费者的网络连接是否正常。服务消费者需要能够正确连接到 ZooKeeper 和服务提供者,才能调用服务。你可以检查服务消费者的网络连接是否正常,确保其可以与 ZooKeeper 和服务提供者建立连接。 4. 检查服务提供者的配置是否正确。服务提供者的配置可能会影响服务消费者的调用。你可以检查服务提供者的配置项,确保其与服务消费者的配置一致。 5. 检查服务提供者的实现是否正确。如果服务提供者的实现有问题,可能会导致服务消费者调用失败。你可以检查服务提供者的实现代码,确保其正确实现了服务接口。 希望这些提示能够帮助你解决问题。如果你需要更多的帮助,请提供更多的上下文和错误信息,我会尽力为你提供帮助。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值