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自己進行管理。
感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!
新聞熱點
疑難解答
圖片精選