2016-02-09 105 views
0

我已經安裝了Eclipse版本並且已經測試了Spring Simple Application,名爲「CrunchifySpringMVCTutorial」。這是一個maven項目。它已經成功構建,並且在開始使用Apache Tomcat時會出現如下錯誤。Apache Tomcat 8.0在Eclipse上啓動失敗者MARS - JAVA EE

Java版本

  • Java的版本
  • Java版本 「1.8.0_65」
  • 的Java(TM)SE運行時環境(建立1.8.0_65-B17)
  • Java HotSpot(TM)64位服務器虛擬機(版本25.65-b01,混合模式)

Eclipse版本

  • 的Eclipse的Java EE IDE的Web開發。
  • 版本:Mars.1版本(4.5.1)
  • 版本ID:20150924-1200

    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.report(FutureTask.java:122) 
        at java.util.concurrent.FutureTask.get(FutureTask.java:192) 
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:917) 
        at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262) 
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 
        at org.apache.catalina.core.StandardService.startInternal(StandardService.java:439) 
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 
        at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:760) 
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 
        at org.apache.catalina.startup.Catalina.start(Catalina.java:625) 
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
        at java.lang.reflect.Method.invoke(Method.java:497) 
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:351) 
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:485) 
    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:1409) 
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1399) 
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 
        at java.lang.Thread.run(Thread.java:745) 
    Caused by: org.apache.catalina.LifecycleException: A child container failed during start 
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:925) 
        at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:868) 
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 
        ... 6 more 
    
    Feb 09, 2016 11:46:19 AM org.apache.catalina.startup.Catalina start 
    SEVERE: The required Server component failed to start so Tomcat is unable to 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:625) 
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
        at java.lang.reflect.Method.invoke(Method.java:497) 
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:351) 
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:485) 
    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:760) 
        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:439) 
        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:925) 
        at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262) 
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 
        ... 11 more 
    
    Feb 09, 2016 11:46:19 AM org.apache.coyote.AbstractProtocol pause 
    INFO: Pausing ProtocolHandler ["http-nio-8080"] 
    Feb 09, 2016 11:46:19 AM org.apache.coyote.AbstractProtocol pause 
    INFO: Pausing ProtocolHandler ["ajp-nio-8009"] 
    Feb 09, 2016 11:46:19 AM org.apache.catalina.core.StandardService stopInternal 
    INFO: Stopping service Catalina 
    Feb 09, 2016 11:46:19 AM org.apache.coyote.AbstractProtocol destroy 
    INFO: Destroying ProtocolHandler ["http-nio-8080"] 
    Feb 09, 2016 11:46:19 AM org.apache.coyote.AbstractProtocol destroy 
    SEVERE: Failed to destroy end point associated with ProtocolHandler ["http-nio-8080"] 
    java.lang.NullPointerException 
        at org.apache.tomcat.util.net.NioEndpoint.releaseCaches(NioEndpoint.java:307) 
        at org.apache.tomcat.util.net.NioEndpoint.unbind(NioEndpoint.java:482) 
        at org.apache.tomcat.util.net.AbstractEndpoint.destroy(AbstractEndpoint.java:795) 
        at org.apache.coyote.AbstractProtocol.destroy(AbstractProtocol.java:531) 
        at org.apache.catalina.connector.Connector.destroyInternal(Connector.java:1023) 
        at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:305) 
        at org.apache.catalina.core.StandardService.destroyInternal(StandardService.java:588) 
        at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:305) 
        at org.apache.catalina.core.StandardServer.destroyInternal(StandardServer.java:850) 
        at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:305) 
        at org.apache.catalina.startup.Catalina.start(Catalina.java:629) 
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
        at java.lang.reflect.Method.invoke(Method.java:497) 
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:351) 
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:485) 
    
    Feb 09, 2016 11:46:19 AM org.apache.coyote.AbstractProtocol destroy 
    INFO: Destroying ProtocolHandler ["ajp-nio-8009"] 
    Feb 09, 2016 11:46:19 AM org.apache.coyote.AbstractProtocol destroy 
    SEVERE: Failed to destroy end point associated with ProtocolHandler ["ajp-nio-8009"] 
    java.lang.NullPointerException 
        at org.apache.tomcat.util.net.NioEndpoint.releaseCaches(NioEndpoint.java:307) 
        at org.apache.tomcat.util.net.NioEndpoint.unbind(NioEndpoint.java:482) 
        at org.apache.tomcat.util.net.AbstractEndpoint.destroy(AbstractEndpoint.java:795) 
        at org.apache.coyote.AbstractProtocol.destroy(AbstractProtocol.java:531) 
        at org.apache.catalina.connector.Connector.destroyInternal(Connector.java:1023) 
        at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:305) 
        at org.apache.catalina.core.StandardService.destroyInternal(StandardService.java:588) 
        at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:305) 
        at org.apache.catalina.core.StandardServer.destroyInternal(StandardServer.java:850) 
        at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:305) 
        at org.apache.catalina.startup.Catalina.start(Catalina.java:629) 
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
        at java.lang.reflect.Method.invoke(Method.java:497) 
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:351) 
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:485) 
    

    手冊啓動和關閉不工作的錯誤。

    [[email protected] bin]# ./startup.sh 
    Using CATALINA_BASE: /usr/local/apache-tomcat-8.0.15 
    Using CATALINA_HOME: /usr/local/apache-tomcat-8.0.15 
    Using CATALINA_TMPDIR: /usr/local/apache-tomcat-8.0.15/temp 
    Using JRE_HOME:  /usr 
    Using CLASSPATH:  /usr/local/apache-tomcat-8.0.15/bin/bootstrap.jar: 
    /usr/local/apache-tomcat-8.0.15/bin/tomcat-juli.jar 
    Tomcat started. 
    
    [[email protected] bin]# ./shutdown.sh 
    Using CATALINA_BASE: /usr/local/apache-tomcat-8.0.15 
    Using CATALINA_HOME: /usr/local/apache-tomcat-8.0.15 
    Using CATALINA_TMPDIR: /usr/local/apache-tomcat-8.0.15/temp 
    Using JRE_HOME:  /usr 
    Using CLASSPATH:  /usr/local/apache-tomcat-8.0.15/bin/bootstrap.jar: 
    /usr/local/apache-tomcat-8.0.15/bin/tomcat-juli.jar 
    

when running application error starting tomcat after automatically shutdown

回答

0

我假設你運行你的Eclipse作爲根。但是,您的「手動啓動」代碼意味着您的手動啓動是以root身份執行的。這通常會導致許多工作文件,臨時文件和其他文件被root用戶擁有,並且不可寫入非特權用戶。

修復方法是更改​​文件的所有權,例如,給你正在執行eclipse的用戶 - 通常是你自己的賬戶。既然文件已經屬於根,你必須這樣做,因爲根以及:

sudo chown --recursive yourusername /usr/local/apache-tomcat-8.0.15 

(替代yourusername,當然)

決不運行如Tomcat Web服務器作爲根 - 你總是希望它作爲非特權用戶運行。否則在tomcat上的任何安全問題都可能意味着攻擊者立即進入root用戶

+0

我改變了上面的內容,但是我仍然看到相同的警告,請看'Feb 09,2016 4:14:33 PM org.apache.tomcat.util警告:[SetPropertiesRule] {Server/Service/Engine/Host/Context}將屬性'source'設置爲'org.eclipse.jst.jee.server:CrunchifySpringMVCTutorial'找不到匹配的屬性。 Feb 09,2016 4:14:33 PM org.apache.catalina.startup.VersionLoggerListener log' @Olaf Kock –

+0

...但現在開始了嗎?這將解決上述問題。警告就是:警告。您可以輕鬆地運行它(現在)或手動配置調試器與源路徑。至少這是一個與上面的問題無關的問題。 –

+0

部署完tomcat服務器後自動關閉**以上錯誤 –