Apache Tomcat 8.0在Eclipse MARS上启动失败者 - JAVA EE

时间:2016-02-09 07:14:10

标签: java eclipse apache spring-mvc tomcat

遵循Eclipse版本我安装了,我测试了Spring Simple Application,名为" CrunchifySpringMVCTutorial"。这是一个maven项目。它已经成功构建,当开始使用Apache tomcat时,它会收到如下错误。

Java版

  • java -version
  • java版本" 1.8.0_65"
  • Java(TM)SE运行时环境(版本1.8.0_65-b17)
  • Java HotSpot(TM)64位服务器VM(版本25.65-b01,混合模式)

Eclipse版

  • 适用于Web开发人员的Eclipse Java EE IDE。
  • 版本: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)
    

    手动启动和关闭工作无误。

    [root@csc 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.
    
    [root@csc 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

1 个答案:

答案 0 :(得分:0)

我假设你以root身份运行你的eclipse。但是,您的“手动启动”代码表示您的手动启动是以root身份执行的。这通常会导致许多工作文件,临时文件和其他文件由root拥有,而对于无特权的用户而言则无法写入。

修复方法是更改​​文件的所有权,例如对于您正在执行eclipse的用户 - 通常是您自己的帐户。既然文件已经属于root,你也必须以root身份执行此操作:

SELECT xid, foo, yid, bar
FROM (
    SELECT 
        x.id xid, x.foo, y.id yid, y.bar,
        dense_rank() over (order by x.id) rank
    FROM x INNER JOIN y ON x.id = y.x_id
    ) sub
WHERE rank <= 2;

 xid | foo | yid |  bar  
-----+-----+-----+-------
   1 | a   |   1 | blue
   1 | a   |   2 | green
   1 | a   |   3 | red
   2 | b   |   4 | big
   2 | b   |   5 | small
(5 rows)

(当然,替换 yourusername

从不以root身份运行像tomcat这样的网络服务器 - 始终希望它以非特权用户身份运行。否则,tomcat上的任何安全问题都可能意味着攻击者立即获得root权限