linux系统,更换tomcat,在另一个服务器上重新部署一套 报如下错误

02-Dec-2019 09:46:31.544 严重 [Catalina-startStop-1] org.apache.catalina.core.ContainerBase.startInternal 子容器启动失败
        java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [org.apache.catalina.webresources.StandardRoot@5eddb0e6]
                at java.util.concurrent.FutureTask.report(FutureTask.java:122)
                at java.util.concurrent.FutureTask.get(FutureTask.java:188)
                at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:931)
                at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:841)
                at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
                at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1412)
                at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1402)
                at java.util.concurrent.FutureTask.run(FutureTask.java:262)
                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:745)
        Caused by: org.apache.catalina.LifecycleException: Failed to start component [org.apache.catalina.webresources.StandardRoot@5eddb0e6]
                at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:440)
                at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:198)
                at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4814)
                at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4949)
                ... 7 more
        Caused by: java.lang.IllegalArgumentException: 指定的主资源集 [/home/anshan/swap/uploadFile] 无效
                at org.apache.catalina.webresources.StandardRoot.createMainResourceSet(StandardRoot.java:748)
                at org.apache.catalina.webresources.StandardRoot.startInternal(StandardRoot.java:706)
                at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
                ... 9 more
02-Dec-2019 09:46:31.547 严重 [Catalina-startStop-1] org.apache.catalina.core.ContainerBase.startInternal 子容器启动失败
        java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [org.apache.catalina.webresources.StandardRoot@50696e43]
                at java.util.concurrent.FutureTask.report(FutureTask.java:122)
                at java.util.concurrent.FutureTask.get(FutureTask.java:188)
                at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:931)
                at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:841)
                at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
                at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1412)
                at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1402)
                at java.util.concurrent.FutureTask.run(FutureTask.java:262)
                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:745)
        Caused by: org.apache.catalina.LifecycleException: Failed to start component [org.apache.catalina.webresources.StandardRoot@50696e43]
                at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:440)
                at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:198)
                at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4814)
                at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4949)
                ... 7 more
        Caused by: java.lang.IllegalArgumentException: 指定的主资源集 [/home/anshan/listener_logs] 无效
                at org.apache.catalina.webresources.StandardRoot.createMainResourceSet(StandardRoot.java:748)
                at org.apache.catalina.webresources.StandardRoot.startInternal(StandardRoot.java:706)
                at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
                ... 9 more

解决方法:我报这个错是因为,tomcat的server.xml文件

<Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true">

        <!-- SingleSignOn valve, share authentication between web applications
             Documentation at: /docs/config/valve.html -->
        <!--
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
        -->

        <!-- Access log processes all example.
             Documentation at: /docs/config/valve.html
             Note: The pattern used is equivalent to using pattern="common" -->
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="/home/anshan/apache-tomcat-8.5.33/logs"
               prefix="localhost_access_log" suffix=".txt"
               pattern="%h %l %u %t &quot;%r&quot; %s %b" />i
               <Context path="/file" docBase="/home/uploadFile" reloadable="true" debug="0"></Context>
               <Context path="/file1" docBase="/home/listener_logs" reloadable="true" debug="0"></Context>
      </Host>

host标签,appBase="webapps"项目打包放在该目录下,通过tomcat访问。

Context 标签docBase="/home/uploadFile" 是静态资源页面访问,ip加tomcat端口号,加path加文件名,直接访问静态文件

我的问题就是tomcat安装完成后 没有docBase对应的文件

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐