今天敲商城的时候,启动tomcat然后就报了这个错误,最后发现是因为Linux的防火墙没有关闭导致的

2017-11-13 09:26:45,448 [localhost-startStop-1] [org.apache.zookeeper.ClientCnxn]-[DEBUG] zookeeper.disableAutoWatchReset is false
2017-11-13 09:26:45,542 [localhost-startStop-1] [org.I0Itec.zkclient.ZkClient]-[DEBUG] Awaiting connection to Zookeeper server
2017-11-13 09:26:45,542 [localhost-startStop-1] [org.I0Itec.zkclient.ZkClient]-[DEBUG] Waiting for keeper state SyncConnected
2017-11-13 09:26:45,568 [localhost-startStop-1-SendThread(192.168.25.128:2181)] [org.apache.zookeeper.ClientCnxn]-[INFO] Opening socket connection to server 192.168.25.128/192.168.25.128:2181. Will not attempt to authenticate using SASL (unknown error)
2017-11-13 09:27:06,571 [localhost-startStop-1-SendThread(192.168.25.128:2181)] [org.apache.zookeeper.ClientCnxn]-[WARN] 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(SocketChannelImpl.java:717)
    at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361)
    at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1141)
2017-11-13 09:27:06,668 [localhost-startStop-1-SendThread(192.168.25.128:2181)] [org.apache.zookeeper.ClientCnxnSocketNIO]-[DEBUG] Ignoring exception during shutdown input
java.nio.channels.ClosedChannelException
    at sun.nio.ch.SocketChannelImpl.shutdownInput(SocketChannelImpl.java:780)
    at sun.nio.ch.SocketAdaptor.shutdownInput(SocketAdaptor.java:399)
    at org.apache.zookeeper.ClientCnxnSocketNIO.cleanup(ClientCnxnSocketNIO.java:200)
    at org.apache.zookeeper.ClientCnxn$SendThread.cleanup(ClientCnxn.java:1246)
    at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1170)
2017-11-13 09:27:06,668 [localhost-startStop-1-SendThread(192.168.25.128:2181)] [org.apache.zookeeper.ClientCnxnSocketNIO]-[DEBUG] Ignoring exception during shutdown output
java.nio.channels.ClosedChannelException
    at sun.nio.ch.SocketChannelImpl.shutdownOutput(SocketChannelImpl.java:797)
    at sun.nio.ch.SocketAdaptor.shutdownOutput(SocketAdaptor.java:407)
    at org.apache.zookeeper.ClientCnxnSocketNIO.cleanup(ClientCnxnSocketNIO.java:207)
    at org.apache.zookeeper.ClientCnxn$SendThread.cleanup(ClientCnxn.java:1246)
    at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1170)
2017-11-13 09:27:07,775 [localhost-startStop-1-SendThread(192.168.25.128:2181)] [org.apache.zookeeper.ClientCnxn]-[INFO] Opening socket connection to server 192.168.25.128/192.168.25.128:2181. Will not attempt to authenticate using SASL (unknown error)
2017-11-13 09:27:28,778 [localhost-startStop-1-SendThread(192.168.25.128:2181)] [org.apache.zookeeper.ClientCnxn]-[WARN] Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect

解决方案:关闭防火墙

这里写图片描述

几条关于防火墙的命令:

1.查看状态:firewall-cmd -state
开启状态:running
关闭状态:not running
2.关闭防火墙:systemctl stop firewalld.service
3.开机不启动防火墙:systemctl disable firewalld.service

之前查到的一些资料都是使用service而不是systemctl,其实也就是systemctl是新的指令,它融合之前service和chkconfig的功能于一体,更加强大,有兴趣的同学可以单独的查一些资料

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐