简体   繁体   中英

java.lang.NoSuchMethodError: org.apache.catalina.Context.addLifecycleListener

I am trying to setup my java workspace with eclipse and tomcat apache server, done with java environmental variables setup as below,

Eclipse Java EE IDE for Web Developers - Version: Indigo Service Release 2 Apache Tomcat v 7

UserVariables: CLASSPATH : .;C:\\Program Files\\Java\\jdk1.8.0\\lib;C:\\Program Files\\Java\\jdk1.8.0\\jre\\lib JAVA_HOME : C:\\Program Files\\Java\\jdk1.8.0 JDK_HOME : %JAVA_HOME% JRE_HOME : C:\\Program Files\\Java\\jdk1.8.0\\jre

System variables: Path : %SystemRoot%\\system32;%SystemRoot%;%SystemRoot%\\System32\\Wbem;%SYSTEMROOT%\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files\\Java\\jdk1.8.0\\bin;C:\\Windows\\System32\\;C:\\Windows\\;C:\\Windows\\System32\\Wbem

On starting server, its stops printing the below logs in the console, I am not sure where I am wrong, Please help on this..

Jul 09, 2016 11:01:48 AM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre8\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java/jre8/bin/client;C:/Program Files/Java/jre8/bin;C:/Program Files/Java/jre8/lib/i386;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;D:\eclipse;;.
Jul 09, 2016 11:01:49 AM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Jul 09, 2016 11:01:49 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 600 ms
Jul 09, 2016 11:01:49 AM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Jul 09, 2016 11:01:49 AM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.32
Jul 09, 2016 11:01:49 AM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Jul 09, 2016 11:01:49 AM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Jul 09, 2016 11:01:49 AM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/31  config=null
java.lang.NoSuchMethodError: org.apache.catalina.Context.addLifecycleListener(Lorg/apache/catalina/LifecycleListener;)V
    at org.apache.catalina.core.ThreadLocalLeakPreventionListener.registerContextListener(ThreadLocalLeakPreventionListener.java:153)
    at org.apache.catalina.core.ThreadLocalLeakPreventionListener.registerListenersForHost(ThreadLocalLeakPreventionListener.java:148)
    at org.apache.catalina.core.ThreadLocalLeakPreventionListener.registerListenersForEngine(ThreadLocalLeakPreventionListener.java:141)
    at org.apache.catalina.core.ThreadLocalLeakPreventionListener.registerListenersForServer(ThreadLocalLeakPreventionListener.java:132)
    at org.apache.catalina.core.ThreadLocalLeakPreventionListener.lifecycleEvent(ThreadLocalLeakPreventionListener.java:84)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:759)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:303)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:431)

The problem was that the tomcat jar files were installed in the $CATALINA_BASE/lib and the CATALINA_HOME was pointing to a different version of tomcat than what was in the $CATALINA_BASE/lib.

Use Tomcat 7.0.21 or above

in order to create new workspace use following steps: step1: open eclipse with new workspace [don't use old workspace]

step2: create simple web/project application [at project creation time eclipse ask for jdk and jre point to those which you want to use]

step3: add only those jars which needed [this type of problem also occur when one jar override class of other in this case you have added GWT jars??]

step4: add tomact [rather than installing use stand alone]

step5: check all ports are avilable if not change it

*when you made some configuration level changes clean tomcat work directory

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM