`

registered the JBDC driver [com.mysql.jdbc.Driver] but failed to unregister

    博客分类:
  • Java
 
阅读更多

异常如下:

Java代码  收藏代码
严重: The 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.  2011 - 1 - 17   14 : 57 : 03  org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc 
严 重: The web application [] registered the JBDC driver [org.apache.derby.jdbc.ClientDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.  2011 - 1 - 17   14 : 57 : 03  org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 
严 重: The web application [] appears to have started a thread named [MySQL Statement Cancellation Timer] but has failed to stop it. This is very likely to create a memory leak.  2011 - 1 - 17   14 : 57 : 03  org.apache.catalina.loader.WebappClassLoader clearReferencesThreads  


这个主要是DBCP的bug在如下链接中已经提出:
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.

I was able to fix it by overriding close method this way:

Java代码  收藏代码
  1. public   class  XBasicDataSource  extends  BasicDataSource {  
  2.     @Override   
  3.     public   synchronized   void  close()  throws  SQLException {  
  4.         DriverManager.deregisterDriver(DriverManager.getDriver(url));  
  5.         super .close();  
  6.     }  
  7. }  



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.

分享到:
评论
1 楼 LovingBaby 2013-03-30  
遇到了这个问题,原来如此呀~dbcp的bug,另一说是tomcat检测出了内存泄露,归根到底就是这个bug么?

相关推荐

    Proxool-0.9.1

    SEVERE: The web application [/xxx] 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 ...

    关闭tomca报错t,网络整理

    严重: The web application [/img] 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...

    Tomcat报错: JDBC unregister 解决办法

    主要介绍了Tomcat报错: JDBC unregister 解决办法的相关资料,需要的朋友可以参考下

    DriverStudio 3.2 For VisualStudio 2005 补丁

    <br>原文件说明: <br>Compuware DriverStudio – DriverSuite Version 3.2 <br>Version 3.2 VisualStudio 2005 Integration fix. The purpose of this update is to allow DriverStudio – ...

    Senfore_DragDrop_v4.1

    I have not been able to reproduce these errors, but I believe the following work around will fix the problem: In the project options of *all* projects which uses these components, add the following...

    Unregister-MissingMSIs.ps1

    Windows Installer注册表修复工具 作者源址:https://gist.github.com/heaths/77fbe0b44496960fab25c2eb0b9e8475

    dx修复工具

    The Online Edition is similar to the Standard Edition, but the files for repairing are not included in Online Edition. Consequently, Internet connection is required when it is repairing the files. ...

    com.zend.php.core_9.0.0.201111081531.jar

    第一步:如果已经安装过Zend Studio 9.0的,请打开Zend Studio 9.0,在菜单中“help>Unregister”,如果显示是灰的跳过此步退出Zend Studio。如果显示可以点击的请点击,这时Zend Studio会重启,重启到要求你填注册码...

    plsqldev14.0.0.1961x64多语言版+sn.rar

    The new viewer allows you to ignore differences in case and white space as usual, but it can also ignore differences in comments. Program Window enhancements The Program Window now highlights ...

    plsqldev14.0.0.1961x32多语言版+sn.rar

    The new viewer allows you to ignore differences in case and white space as usual, but it can also ignore differences in comments. Program Window enhancements The Program Window now highlights ...

    evid4226patch223d-en.zip_EvID4226Patch22_EvID4226Patch223d_EvID4

    Please place this entire folder (complete with contents) into your System32 directory folder ...Double click on the UnRegister .bat file to UnRegister It s as simple as that! Cheers

    ActiveX Manager

    How many times have you tried to register/unregister an ActiveX control (OCX) and wished there was a better way to do it then REGSVR32? ActiveX Manager enables users and developers to manage ...

    VB编程资源大全(英文控件)

    MouseHook.zip This control provides a nice, elegant way of reacting to the movement of the mouse wheel and other mouse functionality<END><br>44,rscomm.zip Serial Comm control that provides the ...

    softap_ap6212a0_tinav2.1_验证通过_旧版本的系统_20170915_1223没有外层目录.7z

    旧版本版本的全志R16平台的tinav2.1的系统打开softAP 2017/9/14 17:25 版本:V1.0 1、原始编译: ...rootroot@cm-System-Product-Name:~$ cd /home/wwt/ ...rootroot@cm-System-Product-Name:/home/wwt$ tar zxvf...

    Android代码-如何自己实现一个 EventBus

    EventBus.unRegister(this) 实现事件 Event 实体类(实现 IEvent 接口) class XXXXEvent: IEvent 发送事件 EventBus.post(XXXEvent()) 利用注解实现事件订阅执行方法 tag 用于细化区分事件 mode 方法执行线程 @...

    gertt点阵图读取器(opengl)

    MessageBox(NULL,"Failed To Register The Window Class.","ERROR",MB_OK|MB_ICONEXCLAMATION); return FALSE; // Return FALSE } if (fullscreen) // Attempt Fullscreen Mode? { ...

    opengl画图程序附带源代码

    MessageBox(NULL,"Failed To Register The Window Class.","ERROR",MB_OK|MB_ICONEXCLAMATION); return FALSE; // Return FALSE } if (fullscreen) // Attempt Fullscreen Mode? { DEVMODE dmScreenSettings; //...

    通信模块封装同步ModuleBus.zip

    For example on Android, activities and fragments should usually register according to their life cycle:@Override public void onStart() {  super.onStart();  ModuleBus.getInstance().register(this)...

    OSGI in Action

    Introducing lifecycle to the paint program 73 ■ The OSGi framework’s role in the lifecycle 75 ■ The bundle activator manifest entry 76 ■ Introducing the lifecycle API 77 ■ Lifecycle state diagram...

    GVIM 7.2.293

    自己编译的GVIM,带OLE,补丁更新到7.2.293 压缩包只有GVIM.exe和gvimext.dll,覆盖到原目录。...make -f Make_mvc.mak GUI=yes OLE=no USERNAME=Fanicy USERDOMAIN=www.fanicy.com IME=yes CSCOPE=yes

Global site tag (gtag.js) - Google Analytics