tomcat重启警告:Abandoned connection cleanup thread)
报错信息
The web application [HelloWeb] 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(Unknown Source)
com.mysql.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:43)
解决方法
web.xml中加一个监听器;
<listener>
<listener-class>com.ls.utils.ContextFinalizer</listener-class>
</listener>
新建一个ContextFinalizer,在tomcat重启的时候,手动杀掉mysql的进程,类如下:
/**
*
*/
/**
* @author cdy
*
*/
package com.ls.utils;
import java.sql.Driver;
import java.sql.Dri