java.lang.ClassNotFoundException: org.apache.catalina.core.ThreadLocalLeakPreventionListener
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6559952/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
java.lang.ClassNotFoundException: org.apache.catalina.core.ThreadLocalLeakPreventionListener
提问by rogcg
I'm trying to create a web service and deply it on Tomcat. I'm following this tutorial.
我正在尝试创建一个 Web 服务并将其部署在 Tomcat 上。我正在关注本教程。
I'm using Eclipse Europa.
我正在使用 Eclipse Europa。
But when I try to start the server it returns this error:
但是当我尝试启动服务器时,它返回此错误:
java.lang.ClassNotFoundException: org.apache.catalina.core.ThreadLocalLeakPreventionListener
at java.net.URLClassLoader.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
at org.apache.tomcat.util.digester.ObjectCreateRule.begin(ObjectCreateRule.java:205)
at org.apache.tomcat.util.digester.Rule.begin(Rule.java:153)
at org.apache.tomcat.util.digester.Digester.startElement(Digester.java:1356)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:504)
at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:182)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1320)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2732)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:625)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:488)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:812)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:741)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:123)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1208)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:525)
at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1642)
at org.apache.catalina.startup.Catalina.load(Catalina.java:524)
at org.apache.catalina.startup.Catalina.load(Catalina.java:562)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:262)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:430)
采纳答案by Bozho
The ThreadLocalLeakPreventionListener
was added recently to tomcat. It is available in tomcat 7 as well as the latest version(s) of tomcat 6. Make sure you have the latest tomcat 6, with a clean installation (your installation might have the server.xml
from the new version and the jars from the older one)
在ThreadLocalLeakPreventionListener
最近添加到tomcat的。它在 tomcat 7 以及最新版本的 tomcat 6 中可用。确保您拥有最新的 tomcat 6,并进行server.xml
全新安装(您的安装可能包含来自新版本的 jar 和来自旧版本的 jar)
回答by Kuldeep Tiwari
Your web.xml contains entry for a listener whose code was added in Tomcat 7.0.6 and onwards, but your tomcat is older than that -
你的 web.xml 包含一个监听器的条目,它的代码是在 Tomcat 7.0.6 及以后添加的,但你的 tomcat 比那个更旧 -
org.apache.catalina.core.ThreadLocalLeakPreventionListener
org.apache.catalina.core.ThreadLocalLeakPreventionListener
回答by Abhishyam
even i faced the same issue.What you need to do is, go to servers tab and left click on Apache server and click on properties. There you can see Location pointing to [workspace metadata]. Click on switch Location. It will switch to Apache location /Servers/Tomcat xxx.Apply the changes and save.
即使我遇到了同样的问题。你需要做的是,转到服务器选项卡,左键单击 Apache 服务器,然后单击属性。在那里您可以看到 Location 指向 [workspace metadata]。点击切换位置。它将切换到 Apache 位置 /Servers/Tomcat xxx.Apply 更改并保存。
回答by user3709172
If you are using the class in server.xml you need to remove it to get rid of the error/Exception.
如果您在 server.xml 中使用该类,则需要将其删除以消除错误/异常。
<Listener
className="org.apache.catalina.core.ThreadLocalLeakPreventionListener"/>