dubbo註冊zookeeper保錯原因
我的zookeeper是安裝在本地,用的預設埠2181,版本3.4.10。dubbo版本2.5.8。
dubbo-demo-provider.xml配置檔案修改為:
<dubbo:registry address="zookeeper://127.0.0.1:2181"/>
執行Provider就會報下面的錯:
[24/12/17 04:56:57:057 CST] main ERROR zkclient.ZkClientWrapper: [DUBBO] Timeout! zookeeper server can not be connected in : 30000ms!, dubbo version: 2.0.0, current host: 127.0.0.1
最後導致
Caused by: java.lang.IllegalStateException: Zookeeper is not connected yet!
at com.alibaba.dubbo.remoting.zookeeper.zkclient.ZkClientWrapper.createPersistent(ZkClientWrapper.java:82)
at com.alibaba.dubbo.remoting.zookeeper.zkclient.ZkclientZookeeperClient.createPersistent(ZkclientZookeeperClient.java:45)
at com.alibaba.dubbo.remoting.zookeeper.support.AbstractZookeeperClient.create(AbstractZookeeperClient.java:47)
at com.alibaba.dubbo.remoting.zookeeper.support.AbstractZookeeperClient.create(AbstractZookeeperClient.java:41)
at com.alibaba.dubbo.remoting.zookeeper.support.AbstractZookeeperClient.create(AbstractZookeeperClient.java:41)
at com.alibaba.dubbo.remoting.zookeeper.support.AbstractZookeeperClient.create(AbstractZookeeperClient.java:41)
at com.alibaba.dubbo.registry.zookeeper.ZookeeperRegistry.doRegister(ZookeeperRegistry.java:110)
... 21 more
求解答,非常感謝!
解決辦法:
1,檢查jdk版本,jdk1.6 dubbo 2.5版本,2.6版本則使用jdk1.8,dubbo的版本過高或者過低的原因!
2,配置zookeeper中的配置檔案,配置超時時間,配大一點!