关闭Tomcat报错The web application [ROOT] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak.
今天在写项目的时候发现,在关闭服务器后Tomcat抛出如下异常:
"C:\Program Files\Apache Software Foundation\Tomcat 8.0\bin\catalina.bat" stop
Using CATALINA_BASE: "C:\Users\Hoictas\.IntelliJIdea15\system\tomcat\Tomcat_8_0_33_StudentInforMS"
Using CATALINA_HOME: "C:\Program Files\Apache Software Foundation\Tomcat 8.0"
Using CATALINA_TMPDIR: "C:\Program Files\Apache Software Foundation\Tomcat 8.0\temp"
Using JRE_HOME: "C:\Program Files\Java\jdk1.8.0_73"
Using CLASSPATH: "C:\Program Files\Apache Software Foundation\Tomcat 8.0\bin\bootstrap.jar;C:\Program Files\Apache Software Foundation\Tomcat 8.0\bin\tomcat-juli.jar"
16-Dec-2016 14:44:48.137 INFO [main] org.apache.catalina.core.StandardServer.await A valid shutdown command was received via the shutdown port. Stopping the Server instance.
16-Dec-2016 14:44:48.139 INFO [main] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["http-nio-8888"]
16-Dec-2016 14:44:48.197 INFO [main] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["ajp-nio-8009"]
16-Dec-2016 14:44:48.249 INFO [main] org.apache.catalina.core.StandardService.stopInternal Stopping service Catalina
16-Dec-2016 14:44:48.325 WARNING [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesJdbc The web application [ROOT] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
16-Dec-2016 14:44:48.333 WARNING [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [ROOT] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
java.lang.Object.wait(Native Method)
java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:143)
com.mysql.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:40)
16-Dec-2016 14:44:48.375 INFO [main] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["http-nio-8888"]
16-Dec-2016 14:44:48.385 INFO [main] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["ajp-nio-8009"]
16-Dec-2016 14:44:48.466 INFO [main] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["http-nio-8888"]
16-Dec-2016 14:44:48.469 INFO [main] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["ajp-nio-8009"]
Disconnected from server
后来发现是因为我把连接mysql的mysql-connector-java-5.1.26-bin.jar放到tomcat的lib下,同时还依赖了另一个jar包而引起的问题
解决办法:
只要将tomcat的lib下这个mysql-connector-java-5.1.26-bin.jar包删掉就可以了。