欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  网络运营

Tomcat报错: JDBC unregister 解决办法

程序员文章站 2022-10-29 10:28:14
 tomcat报错: jdbc unregister 解决办法 摘要: the web application [web application] regist...

 tomcat报错: jdbc unregister 解决办法

摘要: the web application [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 has been forcibly unregistered.

tomcat6关闭时触发日志提示:

the web application [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 has been forcibly unregistered.

原因是tomcat6最新版本引入内存溢出检测阻止机制,检测到jdbc在tomcat运行时进行注册,但是当tomcat停止时没有解除注册。

有两个方法可以解决这个问题:

    1、显式的解除注册

// example: drivermanager.getdriver("jdbc:mysql://localhost:3306");
java.sql.driver mysqldriver = drivermanager.getdriver("your driver");
drivermanager.deregisterdriver(mysqldriver);

    2、使用tomcat jdbc连接池,并将jdbc驱动包拷贝至tomcat的lib下,由tomcat自己进行管理。

  感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!