registered the JBDC driver [oracle.jdbc.OracleDriver] but failed to unregister it when the web application was stopped. (转)
最近项目中遇见一问题,在开发环境没有问题的代码,到了生产环境就会报如下错误:
To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
今天开始学习了struts2, 于是下了最新的版本struts2.2.3.1,在使用的过程中总是报错:A web application created a ThreadLocal with key of type , 尽管出现了这个错误,但是并不妨碍程序正常运行, 虽然程序虽然能正常运行,但是看的这个错误很是别扭,所以网上搜了一下看看,也就有了下面这篇文章
struts2关于A web application created a ThreadLocal with key of type 异常解决办法
created a ThreadLocal with key of type [com.opensymphony.xwork2.inject.ContainerImpl$10] (value [com.opensymphony.xwork2.inject.ContainerImpl$10@12c74b9]) and a value of type [java.lang.Object[]] (value [[Ljava.lang.Object;@1a34544]) but failed to remove it。。。。
这类问题的解决办法:
http://confluence.atlassian.com/pages/viewpage.action?pageId=218275753
看看老外的这篇,好像就是在讲这个问题,原因大概是说tomcat 6.025之后引入了一种内存泄露的检查机制,会把不能垃圾收集的对像做日志。
第一种解决办法:
使用低于6版本的tomcat
第二种解决办法:
在tomcat的server.xml文件(在tomcat的安装路径下的conf文件夹里)中把
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener"/>
这个监听给关了。
就是用<!--。。。-->把下面三句话括起来就可以啦。
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" /> <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" /> <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
http://blog.csdn.net/zhuhezan/article/details/6882089
Description
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.
I was able to fix it by overriding close method this way:
public class XBasicDataSource extends BasicDataSource {
@Override
public synchronized void close() throws SQLException {
DriverManager.deregisterDriver(DriverManager.getDriver(url));
super.close();
}
}
but I think it should be probably the default behavior of BasicDataSource. Or perhaps there should be some flag/setting on BasicDataSource, named "deregisterDriverAtClose" or so.
registered the JBDC driver [oracle.jdbc.OracleDriver] but failed to unregister it when the web application was stopped. (转)的更多相关文章
- 严重: The web application [] registered the JDBC driver [com.microsoft.sqlserver.jdbc.SQLServerDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDB
idea项目启动报如下错误, 网上的方法都试了都没用, 一直没解决, 干掉项目, 重新从svn检出就好了...坑 啊 Root WebApplicationContext: initializatio ...
- 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.
问题是tomcat的版本问题,tomcat新检测机制导致的这个问题,换版本可以解决问题,但不建议这么做,租用服务器不是你说换就换的.其实问题根源是BasicDataSource,BasicDataSo ...
- 解决:The web application [] registered the 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.
问题描述 在将Spring Boot程序打包生成的war包部署到Tomcat后,启动Tomcat时总是报错,但是直接在IDEA中启动Application或者用"java -jar" ...
- The web application registered the 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.
最近使用了最新版的tomcat9,使用jdbc链接mysql数据库.关闭tomcat过程中出现警告 13-Sep-2017 22:22:54.369 WARNING [main] org.apache ...
- [tomcat启动报错]registered the JDBC driver [com.alibaba.druid.proxy.DruidDriver] but failed to unregister it when the web application was stopped
环境:一个tomcat ,一个工程配置了多数据源,在启动的时候报如下错误: SEVERE: The web application [/qdp-resource-job] registered the ...
- The web application [ ] registered the JDBC driver [net.sourceforge.jtds.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver
出现以下错误时,我找了很多方法,都未解决,网上有很多,最后我实在无奈,怀疑会不会是Tomcat的原因,更换了一个版本之后就好了.The web application [ ] registered t ...
- registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped.
最近在用maven整合SSH做个人主页时候,在eclipse里面使用tomcat7插件发布项目是没有问题的,但当打包成war之后,使用tomcat7单独发布项目,就出现了以下的错误. 严重: Cont ...
- The web application [/codeMarket] registered the JBDC driver[.........] but failed to unregister it when the web application was stopped. To prevent
如果你报错了上面的这个严重,那么你的tomcat版本一定是在6.0.25之上的 原因:tomcat 6.025以后在sever.xml中引入了内存泄露侦测,对于垃圾回收不能处理的对像,它就会做日志. ...
- java.lang.ClassNotFoundException:oracle.jdbc.OracleDriver
在使用JDBC时经常碰到java.lang.ClassNotFoundException:oracle.jdbc.OracleDriver问题 这是jvm找不到驱动类文件,可能是以下原因: 没有导入驱 ...
随机推荐
- 转:ReportViewer控件使用方法
a. ReportViewer关联Report1.rdlc的简单呈现b. 对带有报表参数的Report1.rdlc的呈现c. 利用程式生成的DataSet 填充报表d. 调用存储过程 生成DataSe ...
- cf472B Design Tutorial: Learn from Life
B. Design Tutorial: Learn from Life time limit per test 1 second memory limit per test 256 megabytes ...
- Grunt制作个人博客简集
原文:http://www.gbtags.com/gb/share/4916.htm GitHub地址:http://yansm.github.io/fromone/
- Pascal's Triangle II 解答
Question Given an index k, return the kth row of the Pascal's triangle. For example, given k = 3,Ret ...
- python多线程同步
python多线程同步 作者:vpoet 日期:大约在夏季 import threading import time mylock = threading.RLock() num=0 class my ...
- javax.mail用smtp服务器发送带附件的邮件
jar包: javax.mail-1.5.5.jar maven配置: <dependency> <groupId>com.sun.mail</groupId> & ...
- Android系统Surface机制的SurfaceFlinger服务的线程模型分析
文章转载至CSDN社区罗升阳的安卓之旅,原文地址:http://blog.csdn.net/luoshengyang/article/details/8062945 在前面两篇文章中,我们分析了Sur ...
- LR性能测试应用
上半个月,由于工作和上课两边跑,几乎没有属于自己的时间去做自己想做的事,在没有加班的一天晚上,我突然冲动地跑到图书馆借了一本书<LR性能测试应用>——姜艳. 我总喜欢看那些陈旧的书,因为在 ...
- AAC ADTS解析
1.ADTS ADTS全称是(Audio Data Transport Stream),是AAC的一种十分常见的传输格式. 一般的AAC解码器都需要把AAC的ES流打包成ADTS的格式,一般是在AAC ...
- phantomjs API
phantomjs使用说明 phantomjs实现了一个无界面的webkit浏览器.虽然没有界面,但dom渲染.js运行.网络访问.canvas/svg绘制等功能都很完备,在页面抓取. ...