zookeeper Client Session 0x0 for server null

昨天自己写程序来测试调用单机模式的zookeeper服务。服务的安装不说了,网上太多了。当我安装完毕,在虚拟机本地调用zkCli来调试,没有问题。但在虚拟机外调用,总是连接不上,报错:

[08-21 18:20:59 WARN ] org.apache.zookeeper.ClientCnxn$SendThread - Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.ConnectException : Connection timed out: no further information
    at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
    at sun.nio.ch.SocketChannelImpl.finishConnect(Unknown Source)
    at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:286)
    at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1041)
[08-21 18:20:59 DEBUG] org.apache.zookeeper.ClientCnxnSocketNIO - Ignoring exception during shutdown input

最后发现时虚拟机防火墙开着,关闭防火墙后则一切正常。
关闭防火墙命令:service iptables stop

你可能感兴趣的:(java)