解决: Unable to connect to zookeeper server within timeout: 5000

2022-04-13 15:31:32 浏览数 (1)

一个项目启动不起来了,报错如题:

代码语言:javascript复制
Caused by: org.I0Itec.zkclient.exception.ZkTimeoutException: Unable to connect to zookeeper server within timeout: 5000
	at org.I0Itec.zkclient.ZkClient.connect(ZkClient.java:1232)
	at org.I0Itec.zkclient.ZkClient.<init>(ZkClient.java:156)
	at org.I0Itec.zkclient.ZkClient.<init>(ZkClient.java:130)
	at org.I0Itec.zkclient.ZkClient.<init>(ZkClient.java:126)
	at org.I0Itec.zkclient.ZkClient.<init>(ZkClient.java:93)
	at com.alibaba.dubbo.remoting.zookeeper.zkclient.ZkclientZookeeperClient.<init>(ZkclientZookeeperClient.java:29)
	at com.alibaba.dubbo.remoting.zookeeper.zkclient.ZkclientZookeeperTransporter.connect(ZkclientZookeeperTransporter.java:10)
	at com.alibaba.dubbo.remoting.zookeeper.ZookeeperTransporter$Adpative.connect(ZookeeperTransporter$Adpative.java)
	at com.alibaba.dubbo.registry.zookeeper.ZookeeperRegistry.<init>(ZookeeperRegistry.java:69)
	at com.alibaba.dubbo.registry.zookeeper.ZookeeperRegistryFactory.createRegistry(ZookeeperRegistryFactory.java:37)

出错原因: zookeeper 地址配置错了,用的是已废弃的一个服务器上的 zookeeper 服务。

注释掉已废弃地址,改为最新地址:

代码语言:javascript复制
#dubbo.registry.address=zookeeper://116.1xx.xx.xx:2181 // 已废弃地址
dubbo.registry.address=zookeeper://xxx.x4.1xx.xx:2181?register=false
dubbo.registry.client=zkclient

地址配置对了,服务就能正常启动了。

0 人点赞