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、显式的解除注册
1
2
3
|
// 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自己进行管理。
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!
原文链接:https://my.oschina.net/ethan09/blog/205912