2013-06-04 74 views
0

我正在運行tomcat7表單Eclipse,並且還確保Eclipse和Tomcat都使用jdk-1.7.0。服務器說「超時。服務器花了超過45秒啓動」。來自Eclipse服務器超時的Tomcat7

當我在eclipse中爲我的項目更改JDK時發生錯誤,但我在運行配置中將其更改爲相同的JDK。 PS:當我通過終端從eclipse外部啓動tomcat7時,它工作正常,但是當我嘗試在Eclipse內引導它時,它會拋出錯誤。

完整的錯誤如下

A child container failed during start 
    java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/cure]]   
    at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:252) 
    at java.util.concurrent.FutureTask.get(FutureTask.java:111) 
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123) 
    at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:785) 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) 
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) 
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:166) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) 
    at java.lang.Thread.run(Thread.java:722) 
    Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/cure]] 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) 
    ... 7 more 
    Caused by: java.lang.NoClassDefFoundError: HttpServletRequest 
    at java.lang.Class.getDeclaredMethods0(Native Method) 
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2451) 
    at java.lang.Class.getDeclaredMethods(Class.java:1810) 
    at org.apache.catalina.util.Introspection.getDeclaredMethods(Introspection.java:108) 
    at org.apache.catalina.startup.WebAnnotationSet.loadMethodsAnnotation(WebAnnotationSet.java:279) 
    at org.apache.catalina.startup.WebAnnotationSet.loadApplicationServletAnnotations(WebAnnotationSet.java:141) 
    at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:67) 
    at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:405) 
    at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:881) 
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:369) 
    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:5173) 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 
    ... 7 more 
    Caused by: java.lang.ClassNotFoundException: HttpServletRequest 
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714) 
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559) 
    ... 21 more 

Jun 05, 2013 3:31:53 PM 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(FutureTask.java:252) 
    at java.util.concurrent.FutureTask.get(FutureTask.java:111) 
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123) 
    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:684) 
    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:601) 
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:322) 
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:451) 
    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:1559) 
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) 
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:166) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) 
    at java.lang.Thread.run(Thread.java:722) 
Caused by: org.apache.catalina.LifecycleException: A child container failed during start 
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1131) 
    at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:785) 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 
    ... 7 more 

Jun 05, 2013 3:31:53 PM 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:684) 
    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:601) 
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:322) 
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:451) 
    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:1131) 
    at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:302) 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 
    ... 11 more 
+0

你在Tomcat的日誌中看到了什麼?服務器是否在超過45秒後啓動,或者有任何問題? –

+0

它不斷給我在控制檯上面顯示的錯誤。奇怪的是,如果我從外部eclipse啓動tomcat,它工作正常。但是當我嘗試運行eclipse的服務器時,它會拋出這個錯誤。 – Karthik

+0

您是否嘗試過增加服務器超時時間? – agpt

回答

1

如果遷移到另一個JDK是唯一的變化和項目在獨立運行Tomcat,那麼問題是,您的Eclipse /項目JRE版本是從Tomcat的JRE版本不同。

它應該是一樣的。

編輯(後問題更新):

請看this question。 Tomcat類路徑中不應該有任何冗餘庫。

還要確保你沒有觸及任何servlet特定的庫,它們應該被放置在Tomcat/lib並且只能在那裏(沒有移動或複製)。

此外,您的所有第三方庫應放置在您的web應用程序的/WEB-INF/lib,而不是其他位置。

+0

tomcat7和eclipse JRE都指向java7-openjdk-amd64。還有什麼我需要的嗎? – Karthik

+0

在出現新的細節後,我正在編輯我的答案。 –

+0

原來tomcat 7缺少一個servlet-api jar。我重新安裝它,它工作正常。再次感謝! – Karthik