本地安装了zookeeper,调试dubbo时,出现以下问题:java.net.ConnectException: Connection refused: no further information

全部错误是:

2020-08-31 09:04:50.826  INFO 11400 --- [(127.0.0.1:2181)] org.apache.zookeeper.ClientCnxn          : Opening socket connection to server 127.0.0.1/127.0.0.1:218. Will not attempt to authenticate using SASL (unknown error)
2020-08-31 09:04:52.827  WARN 11400 --- [(127.0.0.1:2181)] org.apache.zookeeper.ClientCnxn          : Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect

java.net.ConnectException: Connection refused: no further information
    at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) ~[na:1.8.0_111]
    at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717) ~[na:1.8.0_111]
    at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361) ~[zookeeper-3.4.6.jar:3.4.6-1569965]
    at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1081) ~[zookeeper-3.4.6.jar:3.4.6-1569965]

原因:

1.如果是运行服务提供者时出现的错误,首先确认zookeeper是否启动;如果zookeeper已启动,程序中配置的zookeeper端口号跟zookeeper的端口号是否一致;如果不是以上两种方式都不能解决,重启zookeeper试试。

2.如果是运行服务消费者时出现的问题,首先确认服务提供者是否启动;如果已启动,确定消费者所用的zookeeper端口号跟提供者是否相同

 

你可能感兴趣的:(zookeeper)