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 ...
随机推荐
- $parse , $interpolate ,$complie , $destroy
$parse 是angular 提供的javascript解析器 . var getter = $parse(expression); var setter = getter.assign; cont ...
- cf C. Sereja and Algorithm
http://codeforces.com/contest/368/problem/C 从左向右记录从1位置到每一个位置上x,y,z的个数.然后判断在l,r区间内的x,y,z的关系满不满足abs(x- ...
- KEIL UV3中光标不对齐解决
Keil uVision3与uV2相比增加了对更多型号单片机的支持,另外还对一些的方面进行了优化.不过它却优化出一个让人头疼的问题,那就是光标位置显示不正确!这一问题给程序的编写带来了许多不便.不过不 ...
- 写在学习linux内核协议栈之前
一直很喜欢内核,但是新手,非常的痛苦啊.现在看一本linux内核协议栈源码解析一书,将自己学习的经历以及 理解记录下来,以备将来回头查漏补缺,同时校正自己的理解错误,自勉
- virsh -c exs://ip/?no_verify=1 --readonly nodeinfo
- c语言typedef之数组运用
#include <stdio.h> #include <stdlib.h> typedef ];//int arr[4]取一个别名 arr b c就是int b[4] int ...
- C# - 使用ConfigurationManager保存数据到App.config
1. ConfigurationManager的命名空间:using System.Configuration; 2. To be able to save you have to use a con ...
- Quartz定时调度CronTrigger时间配置格式说明与实例
1. CronTrigger时间格式配置说明 CronTrigger配置格式: 格式: [秒] [分] [小时] [日] [月] [周] [年] 序号 说明 是否必填 允许填写的值 允许的通配符 ...
- java java.uitl.Random产生随机数
通过使用java.uitl.Random产生一个1-10内的随机数.例: Random random = new Random(); int i = Math.abs(random.nextInt() ...
- JSP中getParameter和getAttribute区别
(1)HttpServletRequest类有setAttribute()方法,而没有setParameter()方法 (2)当两个Web组件之间为链接关系时,被链接的组件通过getParameter ...