使用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机制有关系,虽然重启后就可以了,而且也一直运行了很长时间,但是怎么会无缘无故的发生这样的错误呢?