tomcat的两个错误提示

来源:互联网 发布:战斗机 知乎 编辑:程序博客网 时间:2024/06/05 14:57
今天tomcat 6遇到两个错误提示:
1.
严重: A web application 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.


原因:重复加载了jar包。
解决方法:原来我在tomcat的lib文件夹放入了com.mysql.jdbc.Driver的jar包,而又在项目里面重复添加了,导致了上面的提示。删掉其中一个解决问题。


2.The web application [/snoopy] created a ThreadLocal with key of type [com.opensymphony.xwork2.inject.ContainerImpl$10] (value [com.opensymphony.xwork2.inject.ContainerImpl$10@ea85b4]) and a value of type [java.lang.Object[]] (value [[Ljava.lang.Object;@efeff8]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.


原因:tomcat 6.026之后的版本加入了 memory leak detection feature(内存泄露检查)看如下原文:
There is a memory leak detection feature introduced in Tomcat 6.0.26 that attempts to log objects that have failed to be unregistered by webapps it hosts when they are stopped, and were forcibly unregistered by Tomcat. As Tomcat is forcibly removing these objects, it is not a serious concern that these log messages occur.


解决方法:在tomcat 的server.xml文件中将<!-- <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener"/> -->注释掉即可
PS:这是一个治标不治本的方法。
原创粉丝点击