[apache/dubbo]tomcat作为客户端时出现WARN警告

2024-05-30 88 views
8

使用tomcat作为客户端,zookeeper作为注册中心,昨天下午日志出现了一些警告,先是连接zookeeper超时,之后连接状态变为断开,之后又连上了,但是之后就一直报NoClassDefFoundError,具体日志如下:

 2014-08-10 16:42:55,030 [pool-2-thread-1-SendThread(zookeeper1:2181)] INFO  org.apache.zookeeper.ClientCnxn- Client session timed out, have not heard from server in 58334ms for sessionid 0x146ccb73e1301a3, closing socket connection and attempting reconnect
 2014-08-10 16:42:55,030 [ContainerBackgroundProcessor[StandardEngine[Catalina]]-SendThread(zookeeper1:2181)] INFO  org.apache.zookeeper.ClientCnxn- Client session timed out, have not heard from server in 58335ms for sessionid 0x146ccb73e1301a7, closing socket connection and attempting reconnect

 2014-08-10 16:42:55,130 [pool-2-thread-1-EventThread] INFO  org.I0Itec.zkclient.ZkClient- zookeeper state changed (Disconnected)
 2014-08-10 16:42:55,131 [ContainerBackgroundProcessor[StandardEngine[Catalina]]-EventThread] INFO  org.I0Itec.zkclient.ZkClient- zookeeper state changed (Disconnected)

 2014-08-10 16:42:56,624 [ContainerBackgroundProcessor[StandardEngine[Catalina]]-SendThread(zookeeper1:2181)] INFO  org.apache.zookeeper.ClientCnxn- Opening socket connection to server zookeeper1/10.143.80.78:2181
 2014-08-10 16:42:56,624 [ContainerBackgroundProcessor[StandardEngine[Catalina]]-SendThread(zookeeper1:2181)] INFO  org.apache.zookeeper.ClientCnxn- Socket connection established to zookeeper1/10.143.80.78:2181, initiating session
 2014-08-10 16:42:56,641 [ContainerBackgroundProcessor[StandardEngine[Catalina]]-SendThread(zookeeper1:2181)] INFO  org.apache.zookeeper.ClientCnxn- Session establishment complete on server zookeeper1/10.143.80.78:2181, sessionid = 0x146ccb73e1301a7, negotiated timeout = 30000
 2014-08-10 16:42:56,641 [ContainerBackgroundProcessor[StandardEngine[Catalina]]-EventThread] INFO  org.I0Itec.zkclient.ZkClient- zookeeper state changed (SyncConnected)

 2014-08-10 16:42:56,651 [pool-2-thread-1-SendThread(zookeeper1:2181)] INFO  org.apache.zookeeper.ClientCnxn- Opening socket connection to server zookeeper1/10.143.80.78:2181
 2014-08-10 16:42:56,652 [pool-2-thread-1-SendThread(zookeeper1:2181)] INFO  org.apache.zookeeper.ClientCnxn- Socket connection established to zookeeper1/10.143.80.78:2181, initiating session
 2014-08-10 16:42:56,652 [pool-2-thread-1-SendThread(zookeeper1:2181)] INFO  org.apache.catalina.loader.WebappClassLoader- Illegal access: this web application instance has been stopped already.  Could not load org.apache.zookeeper.proto.SetWatches.  The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
 java.lang.IllegalStateException
     at org.apache.catalina.loader.WimeConneebappClassLoader.loadClass(WebappClassLoader.java:1574)
     at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1533)
     at org.apache.zookeeper.ClientCnxn$SendThread.prction(ClientCnxn.java:971)
     at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1146)
 2014-08-10 16:42:56,653 [pool-2-thread-1-SendThread(zookeeper1:2181)] WARN  org.apache.zookeeper.ClientCnxn- Session 0x146ccb73e1301a3 for server zookeeper1/10.143.80.78:2181, unexpected error, closing socket connection and attempting reconnect
 java.lang.NoClassDefFoundError: org/apache/zookeeper/proto/SetWatches
     at org.apache.zookeeper.ClientCnxn$SendThread.primeConnection(ClientCnxn.java:971)
     at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1146)
 Caused by: java.lang.ClassNotFoundException: org.apache.zookeeper.proto.SetWatches
     at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1688)
     at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1533)
     ... 2 more

看起来和tomcat的classloader机制有关系,虽然重启后就可以了,而且也一直运行了很长时间,但是怎么会无缘无故的发生这样的错误呢?

回答

5

这么重要的bug竟然没人解答?

4

@liuluo129 tomcat版本多少,zookeeper版本多少?有没有应用系统自身的日志信息?

6
java.lang.NoClassDefFoundError: org/apache/zookeeper/proto/SetWatches
        at org.apache.zookeeper.ClientCnxn$SendThread.primeConnection(ClientCnxn.java:870)
        at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:363)
        at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1081)
java.lang.NoClassDefFoundError:2016-05-13 10:42:17,854 [localhost-startStop-1-SendThread(192.168.10.3:2181)] INFO  [org.apache.zookeeper.ClientCnxn] - Opening socket connection to server 192.168.10.3/192.168.10.3:2181. Will not attempt to authenticate using SASL (unknown error)
2016-05-13 10:42:17,854 [localhost-startStop-1-SendThread(192.168.10.3:2181)] INFO  [org.apache.zookeeper.ClientCnxn] - Socket connection established to 192.168.10.3/192.168.10.3:2181, initiating session
2016-05-13 10:42:17,854 [localhost-startStop-1-SendThread(192.168.10.3:2181)] WARN  [org.apache.zookeeper.ClientCnxn] - Session 0x154a3d0dcfc0005 for server 192.168.10.3/192.168.10.3:2181, unexpected error, closing socket connection and attempting reconnect
java.lang.NoClassDefFoundError: org/apache/zookeeper/proto/SetWatches
        at org.apache.zookeeper.ClientCnxn$SendThread.primeConnection(ClientCnxn.java:870)
        at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:363)
        at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1081)
2016-05-13 10:42:18,988 [localhost-startStop-1-SendThread(192.168.10.3:2181)] INFO  [org.apache.zookeeper.ClientCnxn] - Opening socket connection to server 192.168.10.3/192.168.10.3:2181. Will not attempt to authenticate using SASL (unknown error)
2016-05-13 10:42:18,988 [localhost-startStop-1-SendThread(192.168.10.3:2181)] INFO  [org.apache.zookeeper.ClientCnxn] - Socket connection established to 192.168.10.3/192.168.10.3:2181, initiating session
2016-05-13 10:42:18,988 [localhost-startStop-1-SendThread(192.168.10.3:2181)] WARN  [org.apache.zookeeper.ClientCnxn] - Session 0x154a3d0dcfc0014 for server 192.168.10.3/192.168.10.3:2181, unexpected error, closing socket connection and attempting reconnect
java.lang.NoClassDefFoundError: org/apache/zookeeper/proto/SetWatches
        at org.apache.zookeeper.ClientCnxn$SendThread.primeConnection(ClientCnxn.java:870)
        at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:363)
        at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1081)
2016-05-13 10:42:19,284 [localhost-startStop-1-SendThread(192.168.10.3:2181)] INFO  [org.apache.zookeeper.ClientCnxn] - Opening socket connection to server 192.168.10.3/192.168.10.3:2181. Will not attempt to authenticate using SASL (unknown error)
2016-05-13 10:42:19,284 [localhost-startStop-1-SendThread(192.168.10.3:2181)] INFO  [org.apache.zookeeper.ClientCnxn] - Socket connection established to 192.168.10.3/192.168.10.3:2181, initiating session
2016-05-13 10:42:19,284 [localhost-startStop-1-SendThread(192.168.10.3:2181)] WARN  [org.apache.zookeeper.ClientCnxn] - Session 0x154a3d0dcfc0005 for server 192.168.10.3/192.168.10.3:2181, unexpected error, closing socket connection and attempting reconnect
java.lang.NoClassDefFoundError: org/apache/zookeeper/proto/SetWatches
        at org.apache.zookeeper.ClientCnxn$SendThread.primeConnection(ClientCnxn.java:870)
        at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:363)
        at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1081)`

我也遇到了,还没找到解决方案 。。。jdk1.8.0_74 tomcat8.0.33

6

同样遇到此问题, 诸位有解决办法吗。

昨天经过测试发现,在我这边发现了一个规律。

测试步骤如下:

  1. 开启容器热部署(某些容器是默认开启)
  2. 启动容器和应用
  3. 通过创建新文件或者删除文件触发热部署
  4. 在热部署重启过程中 重启zookeeper

在热部署重启过程中, zookeeper线程不会停止, 导致zookeeper还会不断重连,重连过程中如果找不到SetWatches类,则会抛出异常,之后就会不断的重试, 由于热部署之后,原来的zookeeper线程的classloader发生了变化, 无法再找到SetWatches,那么此过程就会一直持续下去。

现在尝试把热部署关闭掉看看效果。

6

有人解决这个问题了吗?我用的weblogic,jdk8

5

我这边也遇到了这个bug,有人建议重启服务,线上环境跑了很多的服务,我不可能去把所有服务重启啊!求大神赶快修复这个bug啊

3

@liuluo129

java.lang.NoClassDefFoundError: org/apache/zookeeper/proto/SetWatches

请问这个问题你在当前版本 解决了吗

9

有人解决这个问题了吗?我用的weblogic,jdk8

你这个问题解决了吗 除了版本升级