Tomcat 6.0.32 +Spring dbcp datasource关闭Tomcat出现严重异常
异常如下:
信息: Pausing Coyote HTTP/1.1 on http-
-- :: org.apache.catalina.core.StandardService stop
信息: Stopping service Catalina
-- :: org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
严重: The web application [/tsmanager] 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.
-- :: org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
严重: The web application [/tsmanager] appears to have started a thread named [scheduler_Worker-] but has failed to stop it. This is very likely to create a memory leak.
-- :: org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
严重: The web application [/tsmanager] appears to have started a thread named [scheduler_Worker-] but has failed to stop it. This is very likely to create a memory leak.
-- :: org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
严重: The web application [/tsmanager] appears to have started a thread named [scheduler_Worker-] but has failed to stop it. This is very likely to create a memory leak.
-- :: org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
严重: The web application [/tsmanager] appears to have started a thread named [scheduler_Worker-] but has failed to stop it. This is very likely to create a memory leak.
-- :: org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
严重: The web application [/tsmanager] appears to have started a thread named [scheduler_Worker-] but has failed to stop it. This is very likely to create a memory leak.
-- :: org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
严重: The web application [/tsmanager] appears to have started a thread named [scheduler_Worker-] but has failed to stop it. This is very likely to create a memory leak.
-- :: org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
严重: The web application [/tsmanager] appears to have started a thread named [scheduler_Worker-] but has failed to stop it. This is very likely to create a memory leak.
-- :: org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
严重: The web application [/tsmanager] appears to have started a thread named [scheduler_Worker-] but has failed to stop it. This is very likely to create a memory leak.
-- :: org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
严重: The web application [/tsmanager] appears to have started a thread named [scheduler_Worker-] but has failed to stop it. This is very likely to create a memory leak.
-- :: org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
严重: The web application [/tsmanager] appears to have started a thread named [scheduler_Worker-] but has failed to stop it. This is very likely to create a memory leak.
-- :: org.apache.coyote.http11.Http11Protocol destroy
信息: Stopping Coyote HTTP/1.1 on http-
[QC] INFO [main] org.springframework.context.support.AbstractApplicationContext.doClose() | Closing Root WebApplicationContext: startup date [Thu Mar :: CST ]; root of context hierarchy
[QC] INFO [main] org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.stop() | Stopping beans in phase
[QC] INFO [main] org.quartz.core.QuartzScheduler.standby() | Scheduler scheduler_$_yanshiying-PC1394088762202 paused.
[QC] INFO [main] org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons() | Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1ac7fbb: defining beans [dataSource,jdbcTemplate,xxtsService,wpushDao,httpUtil,cronService,clearDataJob,getNsrInfoJob,scheduler,quartzManager]; root of factory hierarchy
[QC] INFO [main] org.springframework.scheduling.quartz.SchedulerFactoryBean.destroy() | Shutting down Quartz Scheduler
[QC] INFO [main] org.quartz.core.QuartzScheduler.shutdown() | Scheduler scheduler_$_yanshiying-PC1394088762202 shutting down.
[QC] INFO [main] org.quartz.core.QuartzScheduler.standby() | Scheduler scheduler_$_yanshiying-PC1394088762202 paused.
[QC] INFO [main] org.quartz.core.QuartzScheduler.shutdown() | Scheduler scheduler_$_yanshiying-PC1394088762202 shutdown complete.
Tomcat版本为:6.0.32
spring数据源配置如下:
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://127.0.0.1:3306/wzhpush"/>
<property name="username" value="root"/>
<property name="password" value="mysqladmin"/>
</bean>
原因:https://issues.apache.org/jira/browse/DBCP-332
BasicDataSource's method close() doesn't deregister JDBC driver. This causes permgen memory leaks in web server environments, during context reloads. For example, using Tomcat 6.0.26 with Spring, and BasicDataSource declared in Spring context, there is a message printed at web application reload:
SEVERE: A web application registered the JBDC 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.
解决方法:
import java.sql.DriverManager;
import java.sql.SQLException;
import org.apache.commons.dbcp.BasicDataSource; /**
* 解决 关闭Tomcat时报错:the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped
* @author*/
public class WzhBasicDataSource extends BasicDataSource{
@Override
public synchronized void close() throws SQLException {
DriverManager.deregisterDriver(DriverManager.getDriver(url));
super.close();
}
}
Tomcat 6.0.32 +Spring dbcp datasource关闭Tomcat出现严重异常的更多相关文章
- 朝圣Java(问题集锦)之:The Apache Tomcat installation at this directory is version 8.5.32. A Tomcat 8.0 inst
最近开始学Java了.有C#底子,但是学起来Java还是很吃力,感觉别人架好了各种包,自己只要调用就行了,结果还有各种bug出现.掩面中. 启动Tomcat的时候,报错The Apache Tomca ...
- Linux Tomcat 6.0安装配置实践总结
系统环境: Red Hat Enterprise Linux Server release 5.7 (Tikanga) 64位 Tomcat下载 从官方网站 http://tomcat.apache ...
- 实践补充 Installing Tomcat 7.0.x on OS X
我的 Mac 下是1.6的 SDK,下载 Tomcat 8.0 执行后,訪问 http://127.0.0.1:8080 并无反应,并且关闭脚本会报错 : Unsupported major.mino ...
- Target runtime Apache Tomcat v6.0 is not defined
在工程目录下的.settings文件夹里,打开org.eclipse.wst.common.project.facet.core.xml文件,其内容是: <?xml version=" ...
- Solr 5.5.0 + tomcat 7.0.69 + zookeeper-3.4.6 Cloud部署
Solr介绍:Solr是一个独立的企业级搜索应用服务器,Solr基于Lucene的全文搜索服务器,同时对其进行了扩展,提供了比Lucene更为丰富的查询语言,同时实现了可配置.可扩展并对查询性能进行了 ...
- tomcat 8.0 进程没有全部杀死
The web application [FileIO_new_interface] created a ThreadLocal with key of type [java.lang.ThreadL ...
- Mac 下如何下载、启动和关闭Tomcat 和管理Mac自带的Apache
Mac 下载.启动和关闭Tomcat 1. 下载Tomcat(地址:tomcat.apache.org),选择适合的版本(这里选择6.0.48),点击“Download”,之后在新页面点击“Core ...
- tomcat 9.0.4 性能调优
参考了网上的一些优化参数,但是在启动中发现 有2个报错: 11-Feb-2018 15:57:23.293 警告 [main] org.apache.catalina.startup.SetAllPr ...
- linux 系统下配置tomcat,并给tomcat赋予最高操作权限,启动tomcat和关闭tomcat
配置tomcat服器 sudo chmod -R 777 * 给某个文件下所有文件赋予最高的读写权限 红颜色的字是路径,蓝颜色字是命令 (1)官方网站下载tomcat压缩包.apache-tomcat ...
随机推荐
- logstash 利用drop 丢弃过滤日志
input { stdin { } } filter { grok { match => ["message","\s*%{TIMESTAMP_ISO8601}\s ...
- Xmind 快捷键
Xmind 快捷键 快捷键(Windows) 快捷键(Mac) 描述 Ctrl+N Command+N 建立新工作簿 Ctrl+O Command+O 开启工作簿 Ctrl+S Command+S 储 ...
- linux 下的对拍
搞了一上午终于弄好了一个对拍,估计以后调试会方便很多. #!/bin/bash while true; do ./makedate>tmp.in ./XXXXX<tmp.in>tmp ...
- linux下的shell和脚本
1.各种Unix shell linux下的shell基本是从unix环境中的shell发展而来,贴一下wiki:其中我们常用的,可归类为Bourne Shell(/usr/bin/sh或/bin/s ...
- dp优化简单总结
1.二分优化 (使用二分查找优化查找效率) 典型例题:LIS dp[i]保存长度为 i 的上升子序列中最小的结尾,可以用二分查找优化到nlogn 2.数学优化 (通过数学结论减少状态数) 例题1:hd ...
- scp 对拷文件夹 和 文件夹下的所有文件 对拷文件并重命名
对拷文件夹 (包括文件夹本身) scp -r /home/wwwroot/www/charts/util root@192.168.1.65:/home/wwwroot/limesurvey_ba ...
- myeclipse实现Servlet实例(3) 通过继承HttpServlet接口实现
(1) 在软件公司 90%都是通过该方法开发. //在HttpServlet 中,设计者对post 提交和 get提交分别处理 //回忆 <form action="提交给?&qu ...
- 传智播客 Html基础知识学习笔记
HTML基础 <p></p>标志对用来创建一个段落,,<p>标志还可以使用align属性, 它用来说明对齐方式 语法是:<p align="&quo ...
- 第34讲 UI组件之 ProgressDialog和Message
第34讲UI组件之 ProgressDialog和Message 1.进度对话框 ProgressDialog <1>简介 ProgressDialog是AlertDialog类的一个扩展 ...
- (转)Android创建桌面快捷方式两种方法
[IT168技术]Android在桌面上生成快捷方式有两种情况,一种是直接在桌面直接生成;一种是长按桌面,在弹出的快捷菜单中生成. 谈谈在桌面上直接生成.个人觉得这个比较爽快,既然都是快捷方式了干嘛还 ...