- 时间:2022-08-04 13:18 编辑: 来源: 阅读:
- 扫一扫,手机访问
摘要:Tomcat报错: JDBC unregister 解决办法
[b] Tomcat报错: JDBC unregister 解决办法[/b]
摘要: 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.
[b]tomcat6关闭时触发日志提示:[/b]
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停止时没有解除注册。
有两个方法可以解决这个问题:
[b] 1、显式的解除注册[/b]
// Example: DriverManager.getDriver("jdbc:mysql://localhost:3306");
java.sql.Driver mySqlDriver = DriverManager.getDriver("YOUR DRIVER");
DriverManager.deregisterDriver(mySqlDriver);
[b] 2、使用tomcat jdbc连接池,并将jdbc驱动包拷贝至tomcat的lib下,由tomcat自己进行管理。[/b]
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!