2014-03-04 99 views
1

開始時子容器未能UnsupportedClassVersionError例外防止Tomcat的從開始

java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/PersonalCalculator]] 
    at java.util.concurrent.FutureTask$Sync.innerGet(Unknown Source) 
    at java.util.concurrent.FutureTask.get(Unknown Source) 
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1128) 
    at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:782) 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1566) 
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1556) 
    at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) 
    at java.util.concurrent.FutureTask.run(Unknown Source) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) 
    at java.lang.Thread.run(Unknown Source) 
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/PersonalCalculator]] 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) 
    ... 7 more 
Caused by: java.lang.UnsupportedClassVersionError: servlets/CheckContacts : Unsupported major.minor version 51.0 (unable to load class servlets.CheckContacts) 
    at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2893) 
    at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1170) 
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1678) 
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1556) 
    at org.apache.catalina.startup.WebAnnotationSet.loadClass(WebAnnotationSet.java:480) 
    at org.apache.catalina.startup.WebAnnotationSet.loadApplicationServletAnnotations(WebAnnotationSet.java:130) 
    at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:66) 
    at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:381) 
    at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:858) 
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:345) 
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) 
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90) 
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5161) 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 
    ... 7 more 
Mar 4, 2014 3:51:29 AM org.apache.catalina.core.ContainerBase startInternal 
SEVERE: A child container failed during start 
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/p]] 
    at java.util.concurrent.FutureTask$Sync.innerGet(Unknown Source) 
    at java.util.concurrent.FutureTask.get(Unknown Source) 
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1128) 
    at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:782) 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1566) 
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1556) 
    at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) 
    at java.util.concurrent.FutureTask.run(Unknown Source) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) 
    at java.lang.Thread.run(Unknown Source) 
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/p]] 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) 
    ... 7 more 
Caused by: java.lang.UnsupportedClassVersionError: com/servlets/AdminLogin : Unsupported major.minor version 51.0 (unable to load class com.servlets.AdminLogin) 
    at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2893) 
    at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1170) 
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1678) 
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1556) 
    at org.apache.catalina.startup.WebAnnotationSet.loadClass(WebAnnotationSet.java:480) 
    at org.apache.catalina.startup.WebAnnotationSet.loadApplicationServletAnnotations(WebAnnotationSet.java:130) 
    at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:66) 
    at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:381) 
    at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:858) 
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:345) 
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) 
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90) 
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5161) 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 
    ... 7 more 
Mar 4, 2014 3:51:29 AM org.apache.catalina.core.ContainerBase startInternal 
SEVERE: A child container failed during start 
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]] 
    at java.util.concurrent.FutureTask$Sync.innerGet(Unknown Source) 
    at java.util.concurrent.FutureTask.get(Unknown Source) 
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1128) 
    at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:302) 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 
    at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443) 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 
    at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:732) 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 
    at org.apache.catalina.startup.Catalina.start(Catalina.java:675) 
    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:322) 
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:450) 
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]] 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) 
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1566) 
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1556) 
    at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) 
    at java.util.concurrent.FutureTask.run(Unknown Source) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) 
    at java.lang.Thread.run(Unknown Source) 
Caused by: org.apache.catalina.LifecycleException: A child container failed during start 
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1136) 
    at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:782) 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 
    ... 7 more 
Mar 4, 2014 3:51:29 AM org.apache.catalina.startup.Catalina start 
SEVERE: Catalina.start: 
org.apache.catalina.LifecycleException: Failed to start component [StandardServer[8005]] 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) 
    at org.apache.catalina.startup.Catalina.start(Catalina.java:675) 
    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:322) 
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:450) 
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardService[Catalina]] 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) 
    at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:732) 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 
    ... 7 more 
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina]] 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) 
    at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443) 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 
    ... 9 more 
Caused by: org.apache.catalina.LifecycleException: A child container failed during start 
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1136) 
    at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:302) 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 
    ... 11 more 
+0

你不應該發佈你一生! – Salah

回答

0

您的lib文件夾不兼容的類:

java.lang.UnsupportedClassVersionError: servlets/CheckContacts : Unsupported major.minor version 51.0 
1

這可能是由不兼容版本的編譯/運行過程中引起的倍。 (在編譯你的類時,你使用了一個比運行它們時更高的類)。 因此,請在編譯時檢查使用的jdk版本,並且可能在加載服務器時使用相同的版本。

+0

如何在comile和運行時檢查java版本? – Abhi

+0

在編譯時,它是編譯你的類時使用的那個,所以這取決於你如何做或者你使用了哪個工具? 在運行時它是Tomcat AS正在使用的那個,因此一個catalina進程正在使用(大部分時間是$ JAVA_HOME路徑變量)。 – tmarwen

2

UnsupportedClassVersionError表示您已經使用較新的JDK編譯了一些代碼,但它們正在舊JRE上運行。在你的情況下,版本51.0引用了Java7(你正在使用的某個庫已經被編譯 - 在你的情況下,它看起來像servlet API),並且你正在運行一個以前的版本,最有可能的是Java6。

確保您使用的是Java7,問題就會消失。

+0

先生,我使用java1.7.0 .m新的它請幫我解決這個問題 – Abhi

+1

不,你*不*使用Java 1.7 - 至少不是與該Tomcat的安裝。 Java7(或1.7)*可以*執行字節碼與版本51.0,你的不能。檢查你的JAVA_HOME環境變量,並檢查它是否在啓動時明確設置。[bat | sh],setenv。[bat | sh]或者catalina。[bat | sh]。還要檢查你的tomcat旁邊是否有jre目錄,或者是否安裝了多個java版本。另外,我希望1.7.0不是指「沒有補丁」,而是說你在當前的補丁級別,正確​​的(已經超過50) –