• Tomcat异常之——启动报错Failed to start component


    idea中运行tomcat时,遇到异常,异常信息如下:

    16-Jan-2018 16:33:37.325 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDescriptor Deploying configuration descriptor C:UsersAdministrator.IntelliJIdea2017.1system omcatUnnamed_xxx_6confCatalinalocalhostAAA.xml

    16-Jan-2018 16:33:37.331 警告 [localhost-startStop-1] org.apache.catalina.startup.SetContextPropertiesRule.begin [SetContextPropertiesRule]{Context} Setting property 'debug' to '0' did not find a matching property.

    16-Jan-2018 16:33:37.336 严重 [localhost-startStop-1] org.apache.catalina.core.ContainerBase.addChildInternal ContainerBase.addChild: start:

     org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/AAA]]

    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:162)

    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:753)

    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:729)

    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)

    at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:621)

    at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1835)

    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)

    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: Failed to start component [org.apache.catalina.webresources.StandardRoot@1f063757]

    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:162)

    at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4969)

    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5102)

    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)

    ... 10 more

    Caused by: java.lang.IllegalArgumentException: The main resource set specified [G:AAA] is not valid

    at org.apache.catalina.webresources.StandardRoot.createMainResourceSet(StandardRoot.java:746)

    at org.apache.catalina.webresources.StandardRoot.startInternal(StandardRoot.java:704)

    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)

    ... 13 more

     

    16-Jan-2018 16:33:37.338 严重 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDescriptor Error deploying configuration descriptor C:UsersAdministrator.IntelliJIdea2017.1system omcatUnnamed_xxx_6confCatalinalocalhostAAA.xml

     java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/AAA]]

    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:757)

    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:729)

    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)

    at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:621)

    at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1835)

    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)

    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)

     

      网上各种答案:1tomcatjdk版本不匹配;2maven版本冲突;3web.zml中配置错误;4tomcat有缓存.........我都尝试了都没有解决我的问题。

      由于我在tomcat中配置了虚拟路径(什么是虚拟路劲,怎么设置请看http://blog.csdn.net/zjml2412/article/details/49962939),就是在tomcat的安装目录confCatalinalocalhost下新建了一个配置文件AAA.xml文件,文件具体内容为:

        <?xml version="1.0" encoding="UTF-8"?>

        <Context docBase="G:/AAA" reloadable="true" debug="0" path="/AAA"/>

      其中G:/AAA”代表我的电脑磁盘的G盘有个AAA文件,tomcat在启动的时候会加载“G:/AAA”文件夹(文件),以便可以在网络上使用"/AAA"访问,所以说如果G盘没有AAA文件夹(文件),tomcat启动时会出现上面的异常。

      所以说出现上面的异常,1)如果你配置过虚拟路径,并且项目中要用到虚拟路径,那么请先在对应的”G”盘创建”AAA”文件;2)如果没有配置过虚拟路劲,出现上面的异常,你可以将confCatalinalocalhost的文件删除;实在不行,网上下载一个新的tomcat部署项目应该就好了。

    在全栈的道路上,积极向上、成熟稳重、谦虚好学、怀着炽热的心向前方的走得更远。
  • 相关阅读:
    事务
    javascript用window open的子窗口关闭自己并且刷新父窗口
    设置eclipse自动生成的author等注释
    使用Mockito对类成员变量进行Mock
    Linux进程简介
    WebSocket不同版本的三种握手方式以及一个Netty实现JAVA类
    长连接的定义及其优缺点,以及在不同的浏览器中的支持情况
    Sql为什么连接不上服务器上的数据库
    mysql批量导入已经格式好的文本数据
    Ant是什么
  • 原文地址:https://www.cnblogs.com/DDgougou/p/8483574.html
Copyright © 2020-2023  润新知