?
SSM整合小项目关闭时tomcat报错:
The web application [] 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
?
原因似乎是数据库的驱动无法释放。
解决方法:
public class DriverMangerListener implements ServletContextListener {
@Override
public void contextInitialized(ServletContextEvent sce) {
}
public void contextDestroyed(ServletContextEvent sce) {
Enumeration<Driver> enumeration = DriverManager.getDrivers();
while (enumeration.hasMoreElements()) {
try {
DriverManager.deregisterDriver(enumeration.nextElement());
} catch (SQLException e) {
e.printStackTrace();
}
}
}
}
<listener>
<listener-class>com.ssm.listener.DriverMangerListener</listener-class>
</listener>
原文:https://www.cnblogs.com/bxiaoo/p/13828772.html