首页 > 移动平台 > 详细

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

时间:2020-10-16 23:20:45      阅读:40      评论:0      收藏:0      [点我收藏+]

?
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
?
原因似乎是数据库的驱动无法释放。
解决方法:

  • pom.xml中的mysql驱动依赖去掉。
  • 将mysql驱动包添加到tomcat安装目录下的lib文件夹中。
  • 自定义监听器:
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();
            }
        }
    }
}
  • 将该监听器在web.xml中配置:
<listener>
      <listener-class>com.ssm.listener.DriverMangerListener</listener-class>
</listener>
  • ok。
    ?
    ?

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

原文:https://www.cnblogs.com/bxiaoo/p/13828772.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!