the JDBC Driver has been forcibly unregistered.问题



在用eclipse的时候,发现在关闭tomcat(我的版本是6.029)的时候,会报如下的信息:

2010-10-13 2:50:11 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc

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

后来在网上搜了搜,还是有不少人说这个问题吧,感觉出这个问题的原因可能是多种多样,并不是某个固定原因吧。我就简单说说我搜到一个的情况,和我自己的这个问题的解决。

有篇老外的文章http://confluence.atlassian.com/pages/viewpage.action?pageId=218275753

它里有提到个原因:

 

Causes

There is a ?memory leak detection feature introduced in Tomcat 6.0.25 that attempts to log objects that have failed to be Garbage Collected even though they been marked for removal. As the Tomcat and JVM is being shutdown, these messages are not applicable in this situation.


 

我懒是全翻了,大概就是说tomcat 6.025以后引入了内存泄露侦测,对于垃圾回收不能处理的对像,它就会做日志。

老外提出的办法是要么用旧版本的tomcat,要么就在tomcat的server.xml文件中,把

<!– Prevent memory leaks due to use of particular java/javax APIs–>

<Listener className=”org.apache.catalina.core.JreMemoryLeakPreventionListener”/& gt;这个监听给关了。我试了把这个监听关了,就不会再报上面那个信息,但是这样子运行tomcat会不会有其他的问题,我就不得而知了。

实际上我出这个问题是因为我以前要解决警 告:[SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property ‘source’ 这个问题,而在Eclipse中的服务器窗口中的tomcat服务器的设置页面中的Sever Options中勾选了Publish module contexts to separate XML files这个选项,取消这个选项后,就不会再出To prevent a memory leak, the JDBC Driver has been forcibly unregistered。不过在启动tomcat的时候就会出警告那个信息了。

唉,反正是够累的java这边,各产品间的兼容还有产品的bug等问题。反正如果是非工作情况下,只要能凑合用,不影响学习研究就行了,较汁实在是有点耗不起这时间陪它。

the JDBC Driver has been forcibly unregistered.问题。