`

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

    博客分类:
  • SSH
 
阅读更多

寒假时在家看视频学习ssh,第一次将它们整合在一起,就出了问题:

 

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

2012-2-15 15:25:22 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads

严重: The web application [/] appears to have started a thread named [Timer-0] but has failed to stop it. This is very likely to create a memory leak.

 

 

我用的是strut2.2.3+hibernate3+spring2.5.6+tomcat7.0.22+mysql5

 

看tomcat的启动信息是,应用程序注册了jdbc驱动,但是结束时无法注销,tomcat于是为防止内存泄露,强制注销了,

网上说是DBCP的bug

 

于是按https://issues.apache.org/jira/browse/DBCP-332上讲的

 

另外写一个类,继承org.apache.commons.dbcp.BasicDataSource来注销jdbcimport java.sql.DriverManager;

import java.sql.SQLException;

import org.apache.commons.dbcp.BasicDataSource;

public class XBasicDataSource extends BasicDataSource 
{
    @Override
    public synchronized void close() throws SQLException {
        DriverManager.deregisterDriver(DriverManager.getDriver(url));
        super.close();
    }
}

 于是问题终于解决了!不知还有没更好的方法?

分享到:
评论

相关推荐

    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. ...

    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 ...

    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.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 ...

    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 ...

    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

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

    It is like a combo box, but it will drop down a calculator, which you can use for calculation<END><br>39,ColorPicker1.zip It is a color picker control, which is almost similar to those you find in...

    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...

    gertt点阵图读取器(opengl)

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

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

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

    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...

    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; //...

    libdump_sr.zip

    Run ..\LibDump\LibDump.EXE using the command line option -Unregister b. Delete ..\LibDump. -------------------------- 4. COMMENTS AND BUG REPORT -------------------------- If you have any comments,...

    通信模块封装同步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)...

Global site tag (gtag.js) - Google Analytics