在eclipse中啟動tomcat,提示以下錯誤:
2009-1-18 3:11:25 org.apache.catalina.core.AprLifecycleListener init
資訊: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:/Program Files/Eclipse/bin;D:/Tomcat 6.0/bin
2009-1-18 3:11:26 org.apache.coyote.http11.Http11Protocol init
資訊: Initializing Coyote HTTP/1.1 on http-8080
2009-1-18 3:11:26 org.apache.catalina.startup.Catalina load
資訊: Initialization processed in 4172 ms
2009-1-18 3:11:27 org.apache.catalina.core.StandardService start
資訊: Starting service Catalina
2009-1-18 3:11:27 org.apache.catalina.core.StandardEngine start
資訊: Starting Servlet Engine: Apache Tomcat/6.0.10
2009-1-18 3:11:32 org.apache.tomcat.util.modeler.Registry registerComponent
嚴重: Null component Catalina:type=JspMonitor,name=jsp,WebModule=//localhost/sshnews,J2EEApplication=none,J2EEServer=none
java.lang.reflect.InvocationTargetException
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:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: java.lang.UnsupportedClassVersionError: Bad version number in .class file
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1815)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:872)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1325)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)
at org.apache.catalina.startup.WebAnnotationSet.loadClassAnnotation(WebAnnotationSet.java:145)
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationFilterAnnotations(WebAnnotationSet.java:84)
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:57)
at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:297)
at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:1064)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:261)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4238)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1015)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1015)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:448)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
... 6 more
分析:
比如,你項目中的是JRE5.0但compile是JRE6.0則出現上述錯誤。或者版本不一致!
如果工程原來是jre1.5編譯的,換到一個新的MyEclipse版本需要維持用1.5,不能是1.6等,修改辦法:
window-->preferences-->Java-->Compiler-->Compiler compience level將1.6改成1.5
備忘:原文轉載自:http://www.javaeye.com/topic/576365
http://zhoujingxian.javaeye.com/blog/564514