Linux下启动tomcat报错,WARN org.apache.zookeeper.ClientCnxn - Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect java.net.ConnectException:

时间:2023-03-08 18:15:08

  tomcat启动完了之后,一直不停的打印这种错误信息,看表面上,应该是zk节点下的数据是空的,连接不上服务,所以一直在尝试连接,然后一直又连不上;

完整的错误信息:

407662 [usf-ZooKeeper:dsf_default-Registry-SendThread(127.0.0.1:2181)] INFO org.apache.zookeeper.ClientCnxn - Opening socket connection to server 127.0.0.1/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)
407662 [usf-ZooKeeper:dsf_default-Registry-SendThread(127.0.0.1:2181)] WARN org.apache.zookeeper.ClientCnxn - Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.ConnectException: 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:1081)
408763 [usf-ZooKeeper:dsf_default-Registry-SendThread(127.0.0.1:2181)] INFO org.apache.zookeeper.ClientCnxn - Opening socket connection to server 127.0.0.1/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)
408763 [usf-ZooKeeper:dsf_default-Registry-SendThread(127.0.0.1:2181)] WARN org.apache.zookeeper.ClientCnxn - Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.ConnectException: 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:1081)
409864 [usf-ZooKeeper:dsf_default-Registry-SendThread(127.0.0.1:2181)] INFO org.apache.zookeeper.ClientCnxn - Opening socket connection to server 127.0.0.1/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)
409864 [usf-ZooKeeper:dsf_default-Registry-SendThread(127.0.0.1:2181)] WARN org.apache.zookeeper.ClientCnxn - Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.ConnectException: 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:1081)
410965 [usf-ZooKeeper:dsf_default-Registry-SendThread(127.0.0.1:2181)] INFO org.apache.zookeeper.ClientCnxn - Opening socket connection to server 127.0.0.1/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)
410965 [usf-ZooKeeper:dsf_default-Registry-SendThread(127.0.0.1:2181)] WARN org.apache.zookeeper.ClientCnxn - Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.ConnectException: 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:1081)
412066 [usf-ZooKeeper:dsf_default-Registry-SendThread(127.0.0.1:2181)] INFO org.apache.zookeeper.ClientCnxn - Opening socket connection to server 127.0.0.1/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)
412066 [usf-ZooKeeper:dsf_default-Registry-SendThread(127.0.0.1:2181)] WARN org.apache.zookeeper.ClientCnxn - Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.ConnectException: 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:1081)
413167 [usf-ZooKeeper:dsf_default-Registry-SendThread(127.0.0.1:2181)] INFO org.apache.zookeeper.ClientCnxn - Opening socket connection to server 127.0.0.1/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)
413167 [usf-ZooKeeper:dsf_default-Registry-SendThread(127.0.0.1:2181)] WARN org.apache.zookeeper.ClientCnxn - Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.ConnectException: 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:1081)

  原因:又是为了一己之私,省事儿,把服务上的WEB-INFO无情删除,然后用jenkins打包后,就一直有这个问题了,很无奈,找了个大牛给瞅了瞅,说zk一直在尝试连我本地的zk,说明服务上是不是少了一些zk的配置文件呢?大牛给了我提示,我就去classes下看配置文件,和本地的对比了下,果然,少了一个dsf.properties的配置文件,里面就有zk的一些配置,然后手动把这个配置文件给添加到服务上,重启了下,启动成功了!原来这个配置文件是通过提交checklist手动添加的,jenkins不会自动的给打进去,导致了这个尴尬的问题,不过好歹解决了,心里还是松了一口气的!

  配置文件内容如下,应该都是一些dsf的配置项:

############################################
# DSF Core Configuration
############################################
# dsf app name, keep unique in distributed system
dsf.appname=duiba
# dsf global service timeout in millis
dsf.service.timeout=10000
# core size for dsf handle service request thread pool
dsf.worker.core.size=20
# max size for dsf handle service request thread pool
dsf.worker.max.size=40
# queue size for dsf handler service request thread pool
dsf.worker.queues=1000
logTraceSwitch=true
############################################
# DSF Default trace switch
############################################
dsf.trace.switch=true
dsf.sampleRate=1
############################################
# DSF Fail Policy Configuration
############################################
# dsf request fail policy
dsf.service.failpolicy=failover
############################################
# DSF Fail Over Policy Configuration
############################################
dsf.resend.times=3 # dsf timeout configuraion
dsf.client.request.resend.interval=5
dsf.client.request.resend.times=0 ############################################
# DSF Registry Configuration
############################################
dsf.registry.name=zk
dsf.registry.default=zk
############################################
# DSF ZK Registry Configuration
############################################
dsf.registry.zk.type=zookeeper
dsf.registry.zk.connector=DsfZKClient ############################################
# DSF Protocol Configuration
############################################
dsf.protocol.name=dsf
dsf.protocol.default=dsf
############################################
#dsf statistics center switch #default: false
dsf.statistics.switch=false
############################################
# DSF TCP Protocol Configuration
############################################
# dsf tcp protocol type
dsf.protocol.tcp.type=dsf
# dsf tcp protocol listen address,this address must be server address
dsf.protocol.tcp.address=192.168.177.66:22206
#dsf.protocol.tcp.address=10.73.158.171:22106
# max size for dsf tcp protocol acceptor thread pool
dsf.protocol.tcp.threads=1
# queue size for dsf tcp protocol acceptor thread pool
dsf.protocol.tcp.accepts=100
# max size for dsf tcp protocol io thread pool
dsf.protocol.tcp.iothreads=20
# queue size for dsf tcp protocol io thread pool
dsf.protocol.tcp.queues=1000000
# async request waiting quque size for dsf tcp protocol
dsf.protocol.tcp.async.queues=800000
# determine whether dsf tcp protocol iplimit enabled
dsf.protocol.tcp.iplimit.enable=false
# dsf tcp protocol iplimit whiltelist
#dsf.protocol.tcp.iplimit.whitelist=*
# dsf tcp protocol iplimit blacklist
#dsf.protocol.tcp.iplimit.blacklist=
# dsf tcp protocol heartbeat interval in seconds
dsf.protocol.tcp.heartbeat.interval=5
# dsf tcp protocol heartbeat lost count
dsf.protocol.tcp.heartbeat.lostcount=5
# max size for dsf tcp protocol client io thread pool
dsf.protocol.tcp.client.iothreads=1
# queue size for dsf tcp protocol client io thread pool
dsf.protocol.tcp.client.queues=100000
# dsf tcp protocol client reconnect interval in seconds
dsf.protocol.tcp.client.reconnect.interval=3
# dsf tcp protocol client first connect wait time in millis
dsf.protocol.tcp.client.connect.firstwait=2000 ############################################
# DSF Statistic Configuration
############################################
dsf.statistic.delay.enable=false ############################################
# DSF Monitor Configuration
############################################
# dsf time delay monitor time interval in seconds
dsf.monitor.time.interval=30 ############################################
# DSF Default Route Policy
############################################
# dsf global route policy, available: poll, random, serviceDelayTimeRouter
dsf.router.default=poll
dsf.router.poll.localpriority=false ##USF config
zk.server.url=10.211.95.114:6830
zk.session.timeout=50000
rpc.address=192.168.177.66:28914
shutdown.graceful.wait.timeout=60000
slow.service.open=true
slow.service.client.time=500
slow.service.server.time=400 ##updata to dsf3.0 add begin
# DSF threadpool monitor config
threadpool.monitor.switch=true
# unit(s)
threadpool.monitor.interval=30
dsf.application=duiba
#is need auth when zk client connect zk server,on|off
zk.auth.switch=off
zk.auth.dir=
#is need auth when dsf client connect dsf server,true|false
dsf.authentication.enable=false
dsf.rpc.login.identity=
##updata to dsf3.0 add end