java.lang.ClassNotFoundException: org.apache.catalina.core.ThreadLocalLeakPreventionListener

旧时模样 提交于 2019-12-22 03:49:04

问题


I'm trying to create a web service and deply it on Tomcat. I'm following this tutorial.

I'm using 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$1.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)

回答1:


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)




回答2:


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.




回答3:


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 -

org.apache.catalina.core.ThreadLocalLeakPreventionListener




回答4:


If you are using the class in server.xml you need to remove it to get rid of the error/Exception.

<Listener 
className="org.apache.catalina.core.ThreadLocalLeakPreventionListener"/>


来源:https://stackoverflow.com/questions/6559952/java-lang-classnotfoundexception-org-apache-catalina-core-threadlocalleakpreven

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!