每当我重启tomcat的时候,就会报下面的warning。
2016-10-18 14:30:09.470 INFO DubboShutdownHook ZookeeperRegistry:485 - [DUBBO] Destroy registry:zookeeper://172.21.134.7:2005/com.alibaba.dubbo.registry.RegistryService?application=stormsun&dubbo=2.8.4&interface=com.alibaba.dubbo.registry.RegistryService&owner=kaijia&pid=868×tamp=1476760120506, dubbo version: 2.8.4, current host: 127.0.0.1
2016-10-18 14:30:09.471 WARN DubboShutdownHook ZookeeperRegistry:440 - [DUBBO] java/util/concurrent/ScheduledFuture, dubbo version: 2.8.4, current host: 127.0.0.1
java.lang.NoClassDefFoundError: java/util/concurrent/ScheduledFuture
at com.alibaba.dubbo.registry.support.FailbackRegistry.destroy(FailbackRegistry.java:438)
at com.alibaba.dubbo.registry.zookeeper.ZookeeperRegistry.destroy(ZookeeperRegistry.java:88)
at com.alibaba.dubbo.registry.support.AbstractRegistryFactory.destroyAll(AbstractRegistryFactory.java:70)
at com.alibaba.dubbo.config.ProtocolConfig.destroyAll(ProtocolConfig.java:463)
at com.alibaba.dubbo.config.AbstractConfig$1.run(AbstractConfig.java:452)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: Illegal access: this web application instance has been stopped already. Could not load [java.util.concurrent.ScheduledFuture]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForClassLoading(WebappClassLoaderBase.java:1315)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1178)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1139)
... 6 more
Caused by: java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load [java.util.concurrent.ScheduledFuture]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading(WebappClassLoaderBase.java:1325)
at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForClassLoading(WebappClassLoaderBase.java:1313)
... 8 more
2016-10-18 14:30:09.471 INFO ZkClient-EventThread-29-172.21.134.7:2005 ZkEventThread:82 - Terminate ZkClient event thread.
2016-10-18 14:30:09.476 INFO localhost-startStop-1-EventThread ClientCnxn:516 - EventThread shut down
2016-10-18 14:30:09.476 INFO DubboShutdownHook ZooKeeper:544 - Session: 0x157bc04550c0142 closed
2016-10-18 14:30:09.477 INFO DubboShutdownHook DubboProtocol:439 - [DUBBO] Close dubbo server: /172.21.134.7:20883, dubbo version: 2.8.4, current host: 127.0.0.1
2016-10-18 14:30:09.479 WARN DubboShutdownHook HeaderExchangeServer:255 - [DUBBO] java/util/concurrent/ScheduledFuture, dubbo version: 2.8.4, current host: 127.0.0.1
java.lang.NoClassDefFoundError: java/util/concurrent/ScheduledFuture
at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeServer.stopHeartbeatTimer(HeaderExchangeServer.java:251)
at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeServer.doClose(HeaderExchangeServer.java:145)
at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeServer.close(HeaderExchangeServer.java:120)
at com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol.destroy(DubboProtocol.java:441)
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper.destroy(ProtocolFilterWrapper.java:66)
at com.alibaba.dubbo.rpc.protocol.ProtocolListenerWrapper.destroy(ProtocolListenerWrapper.java:72)
at com.alibaba.dubbo.config.ProtocolConfig.destroyAll(ProtocolConfig.java:469)
at com.alibaba.dubbo.config.AbstractConfig$1.run(AbstractConfig.java:452)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: Illegal access: this web application instance has been stopped already. Could not load [java.util.concurrent.ScheduledFuture]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForClassLoading(WebappClassLoaderBase.java:1315)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1178)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1139)
... 9 more
Caused by: java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load [java.util.concurrent.ScheduledFuture]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading(WebappClassLoaderBase.java:1325)
at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForClassLoading(WebappClassLoaderBase.java:1313)
... 11 more
2016-10-18 14:30:09.487 INFO DubboShutdownHook AbstractServer:147 - [DUBBO] Close NettyServer bind /0.0.0.0:20883, export /172.21.134.7:20883, dubbo version: 2.8.4, current host: 127.0.0.1
2016-10-18 14:30:09.495 WARN DubboShutdownHook NettyServer:127 - [DUBBO] org/jboss/netty/util/internal/ExecutorUtil, dubbo version: 2.8.4, current host: 127.0.0.1
java.lang.NoClassDefFoundError: org/jboss/netty/util/internal/ExecutorUtil
at org.jboss.netty.channel.socket.nio.AbstractNioBossPool.releaseExternalResources(AbstractNioBossPool.java:91)
at org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory.releasePools(NioServerSocketChannelFactory.java:223)
at org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory.releaseExternalResources(NioServerSocketChannelFactory.java:218)
at org.jboss.netty.bootstrap.Bootstrap.releaseExternalResources(Bootstrap.java:318)
at com.alibaba.dubbo.remoting.transport.netty.NettyServer.doClose(NettyServer.java:124)
at com.alibaba.dubbo.remoting.transport.AbstractServer.close(AbstractServer.java:156)
at com.alibaba.dubbo.remoting.transport.AbstractServer.close(AbstractServer.java:164)
at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeServer.close(HeaderExchangeServer.java:121)
at com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol.destroy(DubboProtocol.java:441)
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper.destroy(ProtocolFilterWrapper.java:66)
at com.alibaba.dubbo.rpc.protocol.ProtocolListenerWrapper.destroy(ProtocolListenerWrapper.java:72)
at com.alibaba.dubbo.config.ProtocolConfig.destroyAll(ProtocolConfig.java:469)
at com.alibaba.dubbo.config.AbstractConfig$1.run(AbstractConfig.java:452)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: Illegal access: this web application instance has been stopped already. Could not load [org.jboss.netty.util.internal.ExecutorUtil]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForClassLoading(WebappClassLoaderBase.java:1315)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1178)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1139)
... 14 more
Caused by: java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load [org.jboss.netty.util.internal.ExecutorUtil]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading(WebappClassLoaderBase.java:1325)
at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForClassLoading(WebappClassLoaderBase.java:1313)
... 16 more
2016-10-18 14:30:13.291 INFO localhost-startStop-1 ContextLoader:307 - Root WebApplicationContext: initialization started
猜测和目标
看起来像dubbo执行shutdown hook的时候,web application已经停掉了。 我这个强迫症看这个warning特别难受,在tomcat重启的时候我怎样才能优雅的关闭dubbo,消除掉这个warning。
环境 编译方式 <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
JRE
java version "1.8.0_11"
Java(TM) SE Runtime Environment (build 1.8.0_11-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.11-b03, mixed mode)
Tomcat
Apache Tomcat Version 8.0.33