辛星dubbo答疑第五篇:Failed to register dubbo

Exception in thread "main" java.lang.IllegalStateException: Failed to register dubbo://192.168.1.105:20880/com.mengzhidu.java.dubbo.user.service.UserInfoService?anyhost=true&application=demo-provider&bean.name=com.mengzhidu.java.dubbo.user.service.UserInfoService&dubbo=2.0.2&generic=false&interface=com.mengzhidu.java.dubbo.user.service.UserInfoService&methods=hi&pid=98147&side=provider&timestamp=1543761297018 to registry 127.0.0.1:2181, cause: Failed to register dubbo://192.168.1.105:20880/com.mengzhidu.java.dubbo.user.service.UserInfoService?anyhost=true&application=demo-provider&bean.name=com.mengzhidu.java.dubbo.user.service.UserInfoService&dubbo=2.0.2&generic=false&interface=com.mengzhidu.java.dubbo.user.service.UserInfoService&methods=hi&pid=98147&side=provider&timestamp=1543761297018 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=98147&timestamp=1543761292001, cause: KeeperErrorCode = Unimplemented for /dubbo/com.mengzhidu.java.dubbo.user.service.UserInfoService
	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.ProtocolListenerWrapper.export(ProtocolListenerWrapper.java:55)
	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$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.mengzhidu.java.dubbo.user.Application.main(Application.java:16)
Caused by: com.alibaba.dubbo.rpc.RpcException: Failed to register dubbo://192.168.1.105:20880/com.mengzhidu.java.dubbo.user.service.UserInfoService?anyhost=true&application=demo-provider&bean.name=com.mengzhidu.java.dubbo.user.service.UserInfoService&dubbo=2.0.2&generic=false&interface=com.mengzhidu.java.dubbo.user.service.UserInfoService&methods=hi&pid=98147&side=provider&timestamp=1543761297018 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=98147&timestamp=1543761292001, cause: KeeperErrorCode = Unimplemented for /dubbo/com.mengzhidu.java.dubbo.user.service.UserInfoService
	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.mengzhidu.java.dubbo.user.service.UserInfoService
	at com.alibaba.dubbo.remoting.zookeeper.curator.CuratorZookeeperClient.createPersistent(CuratorZookeeperClient.java:79)
	at com.alibaba.dubbo.remoting.zookeeper.support.AbstractZookeeperClient.create(AbstractZookeeperClient.java:67)
	at com.alibaba.dubbo.remoting.zookeeper.support.AbstractZookeeperClient.create(AbstractZookeeperClient.java:62)
	at com.alibaba.dubbo.remoting.zookeeper.support.AbstractZookeeperClient.create(AbstractZookeeperClient.java:62)
	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.mengzhidu.java.dubbo.user.service.UserInfoService
	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.createPersistent(CuratorZookeeperClient.java:76)
	... 28 more

Process finished with exit code 1

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

这里我们只要降低一下curator-framework的版本就可以了,然后贴一个我当前的版本吧:


<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0modelVersion>

    <groupId>com.mengzhidu.java.dubbogroupId>
    <artifactId>user-serviceartifactId>
    <version>1.0-SNAPSHOTversion>
    <modules>
        <module>user-service-clientmodule>
        <module>user-service-servermodule>
    modules>
    <packaging>pompackaging>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.alibabagroupId>
                <artifactId>dubboartifactId>
                <version>2.6.5version>
            dependency>
            
            <dependency>
                <groupId>io.nettygroupId>
                <artifactId>netty-allartifactId>
                <version>4.1.25.Finalversion>
            dependency>
            <dependency>
                <groupId>org.apache.curatorgroupId>
                <artifactId>curator-frameworkartifactId>
                <version>2.6.0version>
            dependency>
        dependencies>
    dependencyManagement>

project>

最终结果是ok的

你可能感兴趣的:(微服务框架-dubbo)