tomcat重启警告:Abandoned connection cleanup thread)
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.DriverManager;
import java.sql.SQLException;
import java.util.Enumeration;import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;import com.mysql.jdbc.AbandonedConnectionCleanupThread;@WebListener
public class ContextFinalizer implements ServletContextListener {public void contextInitialized(ServletContextEvent sce) {}public void contextDestroyed(ServletContextEvent sce) {Enumeration<Driver> drivers = DriverManager.getDrivers();Driver d = null;while (drivers.hasMoreElements()) {try {d = drivers.nextElement();DriverManager.deregisterDriver(d);System.out.println(String.format("ContextFinalizer:Driver %s deregistered", d));} catch (SQLException ex) {System.out.println(String.format("ContextFinalizer:Error deregistering driver %s", d) + ":" + ex);}}try {AbandonedConnectionCleanupThread.shutdown();} catch (InterruptedException e) {System.out.println("ContextFinalizer:SEVERE problem cleaning up: " + e.getMessage());e.printStackTrace();}}
}
tomcat重启警告:Abandoned connection cleanup thread)相关推荐
- tomcat重启警告:Abandoned connection cleanup thread 服务器宕机解决方案
tomcat重启警告:Abandoned connection cleanup thread 服务器宕机解决方案 参考文章: (1)tomcat重启警告:Abandoned connection cl ...
- [Abandoned connection cleanup thread] but has failed to stop it.
错误这样样子: 警告: The web application [xx] appears to have started a thread named [Abandoned connection cl ...
- Abandoned connection cleanup thread failed to stop
问题: A web application appears to have started a thread named [Abandoned connection cleanup thread] b ...
- 分享一例脚本发版和tomcat重启脚本
线上有个网站业务部署在tomcat上,由于频繁上线修改,需要经常启动tomcat. tomcat服务自带的bin下没有重启脚本,下面分享一例脚本发版和tomcat重启脚本: 1)现将业务代码从svn里 ...
- Java--IDEA之Tomcat重启之后无法活化
问题描述: 在 IDEA 上使用 tomcat 部署 web 项目时,可以正常钝化,但是 tomcat 重启之后无法活化. 原因分析: 查看开启tomcat服务器时的提示信息 Using CATALI ...
- abandon connection, owner thread: xxxx, connected at : 1606897800625, open stackTrace
问题现象: 使用Druid的数据库连接池,在进行一个查询SQL的时候,抛出了异常: [2017-10-20 01:40:59.269 ERROR com.alibaba.druid.pool.Drui ...
- The connection pool for database '/data/data/....db' has been unable to grant a connection to thread
The connection pool for database '/data/data/....db' has been unable to grant a connection to thread ...
- Tomcat 启动时间过长 Connection has been abandoned PooledConnection
环境:Tomcat ,使用了jndi 连接oracle 现象:生产环境上的tomcat迁移到新的主机上,在新主机上tomcat启动需要长达20分钟,并且过程中会出现以下警告: 08-Jan-2021 ...
- Tomcat出现警告:[RMI TCP Connection(3)-127.0.0.1] org.apache.tomcat.util.descriptor.web.WebXml.setVersion
解决方案 tomcat.JDK.web.xml 对应关系,向下兼容 web.xml--version2.2--JDK1.1--Tomcat3.3 web.xml--version2.3--JDK1.3 ...
最新文章
- 数据库集群和高可用解决方案
- mysql隔离级别加锁情况_MySQL数据库事务各隔离级别加锁情况--read committed amp;amp; MVCC...
- 开始我的c++学习之路
- java 根据客户端重定向_Java Web笔记 - 转发与重定向的区别与在FireBug客户端的表现...
- 10 非受控组件以及受控与非受控的选择方案
- BZOJ 2660 (BJOI 2012) 最多的方案
- wordpress开放注册_WordPress.com开源,欧洲开放数据门户网站以及更多新闻
- Bootstrap 字体图标使用案例
- windows 32位系统中进程最大可用内存空间为3GB (转)
- 1026 逃跑的拉尔夫
- 判断文本的行数c语言,软件工程统计文件中字符串个数,单词个数,词频,行数
- 我的5年Python7年R,述说她们的差异在哪里?
- iText PDF设置字体样式
- 虚拟化服务器安装方法,Citrix Xenserver:7.0虚拟化服务器安装详细图文教程
- 阿里巴巴实习 面试题
- LDA Effect Size分析 LEfSe详解
- 军团的崛起:利用多态指挥多兵种作战
- TypeScript学习-函数
- 微信支付出现故障,程序员的高薪理所当然
- 第15章 实时时钟DS1302
热门文章
- 09 Softmax回归
- .Net IIS 内存溢出(System.OutOfMemoryException)
- PyTorch搭建卷积神经网络(CNN)进行视频行为识别(附源码和数据集)
- jsTree API文档(中文)
- Java容器(集合)
- Bowtie2错误:Could not locate a Bowtie index corresponding to basename /home/s45/mouse
- 【元胞自动机】元胞自动机交通事故通行【含Matlab源码 1345期】
- LabVIEW应用程序在Windows版本之间的字体变化
- 从全备中恢复单库或单表,小心有坑!
- 谷歌公开了内部管理Infra层的两个工具的Paper