01-Jul-2016 10:49:05.875 WARNING [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesJdbc The web application [ROOT] 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

出现条件:web应用,使用spring,连接池用的bonecp。当修改一点代码,save后,spring会重新加载,然后问题就出现了。

在网上查看资料后,找到了该报告: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.

翻译:

BasicDataSource中的close方法没有注销(deregister)jdbc驱动。在web
server环境中,当reload content时,就引起了堆内存泄露(permgen memory leaks)。例如,当在使用spring和tomcat  6.0.26时,BasicDataSource在Spring
context被声明了,这样就会有一条信息在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.

该地址中 https://issues.apache.org/jira/browse/DBCP-332 提供了一种解决方案。

我并没有使用该方案,因为使用的是bonecp,所以我看了下bonecp的BoneCPDataSource的close方法,发现,其中有个
BoneCPConfig类,其中有这个属性:deregisterDriverOnClose。 于是我在spring的xml配置中,加入了该配置。

解决 01-Jul-2016 10:49:05.875 WARNING [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesJdbc The web application [ROOT] registered the JDBC driver [com.mysql.jdbc.D的更多相关文章

  1. 解决 Tomcat reload WARNING [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesJdbc The web application [] registered the JDBC driver [com.mysql.jdbc.Driver] but fail

    转自:http://www.cnblogs.com/interdrp/p/5632529.html 我的错误如下: 06-Sep-2016 18:57:10.595 WARNING [localhos ...

  2. MIT JOS学习笔记02:kernel 01(2016.10.28)

    未经许可谢绝以任何形式对本文内容进行转载! 在文章开头不得不说的是,因为这部分的代码需要仔细理清的东西太多,所以导致这篇分析显得很啰嗦,还请谅解. 我们在上一篇文章已经分析了Boot Loader的功 ...

  3. Web 项目报错No suitable driver found for jdbc:mysql://localhost:3306/book 的一个解决办法

    确认jar包加入到了build path中,然后注意版本是否与数据库相配,还要留意将jar包放入WEB-INF下的lib文件夹中

  4. Idea运行web项目时,提示java.lang.ClassNotFoundException: com.mysql.jdbc.Driver解决方法

    今天用 idea写了个工程.结果最后报错,错误信息如下: java.lang.ClassNotFoundException: com.mysql.jdbc.Driverat org.apache.ca ...

  5. 解决Mybatis连接Sql server 出现 Cannot load JDBC driver class 'com.mysql.jdbc.Driver '的问题

    tomcat启动的时候没有错误,但是进行数据库操作就会有错误. 在网上找了很久  好不容易找到解决方法 转自 http://blog.csdn.net/ro_bot/article/details/5 ...

  6. JSONArray().fromObject(); 出现org.apache.catalina.core.StandardWrapperValve invoke错误的解决办法

    servlet: public void service(HttpServletRequest request, HttpServletResponse response) throws Servle ...

  7. cloudera-scm-server启动出现Error creating bean with name 'entityManagerFactoryBean'与HHH010003: JDBC Driver class not found: com.mysql.jdbc.Driver错误解决办法(图文详解)

    不多说,直接上干货! 问题详情 -- ::, INFO main:com.cloudera.server.cmf.Main: Starting SCM Server. JVM Args: [-Dlog ...

  8. JDBC 进阶:使用封装通用DML DQL 和结构分层以及at com.mysql.jdbc.PreparedStatement.setTimestamp空指针异常解决

    准备: 数据表 CREATE TABLE `t_user` ( `id` int(11) NOT NULL AUTO_INCREMENT, `username` varchar(10) DEFAULT ...

  9. 错误:“Cannot load JDBC driver class 'com.mysql.jdbc.Driver”的解决方法

    “Cannot load JDBC driver class 'com.mysql.jdbc.Driver ” 表示没有JDBC连接MySql的驱动包,因此需要手动添加驱动包到WEB-INF目录下的l ...

随机推荐

  1. jsp页面不能使用EL表达式

    在页面中添加 <%@ page isELIgnored = "flase" %>

  2. Java并发(8):CountDownLatch、CyclicBarrier、Semaphore、Callable、Future

    CountDownLatch.CyclicBarrier.Semaphore.Callable.Future  都位于java.util.concurrent包下,其中CountDownLatch.C ...

  3. Install Solr+tomcat

    1. chose the release you want: http://archive.apache.org/dist/lucene/solr/. 1) copy [solr_home]/dist ...

  4. android tcp协议主要函数

    1 tcp_timers: 处理各种timer超时信息,关键函数tcp_xmit_timer 2 tcp_iutput: 3 tcp_output:接收方的接收窗口struct tcpcb.snd_w ...

  5. nginx安装启动

    参考:http://network.51cto.com/art/201005/198198_4.htm 下载nginx tar.gz安装包下载pcre tar.gz安装包 安装pcretar zxvf ...

  6. iPad上的Cookie到底有多长?

    [故事背景]: 公司某个站点,特别依赖Cookie的使用,而且用的比较狠.在设计之初想当然地以为到达Cookie上限是猴年马月的事儿,没想到时过境迁,这个上限真的来了. 着手改吧,也不想投入太多.于是 ...

  7. JqueryEasyUI浅谈---视频教程公布

    http://pan.baidu.com/s/1pJqGXez 前两天我在博客园发了一个关于JqueryEasyUI浅谈本地化应用的博客,我简单的介绍了JqueryEasyUI的应用,今天我录制了了一 ...

  8. Topshelf入门

    简介 Topshelf允许我们快速的开发.调试和部署windows服务. 官方网站 使用方法 第一步:安装 Install-Package Topshelf Install-Package Topsh ...

  9. nginx做反向代理并防盗链

    nginx做反向代理真的非常简单,只需设置location+proxy_pass即可. 防盗链配置有些复杂,需要注意的地方: 在防盗链的location中需要再设置一下proxy_pass(在这里走了 ...

  10. [游戏学习24] MFC 各种绘图 字体学习

    >_<:这里包含字体设置及各种绘图,只要稍微看一下代码就能理解,这里不多介绍 >_<:Hello.h #include<afxwin.h> class CMyApp ...