zoukankan      html  css  js  c++  java
  • java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]

    1.问题描述:

      对于创建的springboot项目,通过启动类启动,访问没问题,但打成war部署到tomcat上启动报错,如下:

    严重: ContainerBase.addChild: start:
    org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]
            at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
            at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
            at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
            at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
            at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1095)
            at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1930)
            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: java.lang.NoSuchMethodError: org.apache.tomcat.util.res.StringManager.getManager(Ljava/lang/Class;)Lorg/apache/tomcat/util/res/StringManager;
            at org.apache.tomcat.websocket.WsWebSocketContainer.<clinit>(WsWebSocketContainer.java:79)
            at org.apache.tomcat.websocket.server.WsSci.init(WsSci.java:131)
            at org.apache.tomcat.websocket.server.WsSci.onStartup(WsSci.java:47)
            at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5506)
            at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
            ... 10 more
    
    七月 24, 2018 3:00:16 下午 org.apache.catalina.startup.HostConfig deployWAR
    严重: Error deploying web application archive D:	omcat7-8080-eclipsewebappsROOT.war
    java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]
            at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:905)
            at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
            at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
            at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1095)
            at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1930)
            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)
    
    七月 24, 2018 3:00:16 下午 org.apache.catalina.startup.HostConfig deployWAR
    信息: Deployment of web application archive D:	omcat7-8080-eclipsewebappsROOT.war has finished in 2,494 ms
    七月 24, 2018 3:00:16 下午 org.apache.coyote.AbstractProtocol start
    信息: Starting ProtocolHandler ["http-bio-8080"]
    七月 24, 2018 3:00:16 下午 org.apache.coyote.AbstractProtocol start
    信息: Starting ProtocolHandler ["ajp-bio-8089"]
    七月 24, 2018 3:00:16 下午 org.apache.catalina.startup.Catalina start
    信息: Server startup in 2571 ms

    2.问题分析:

      该错是由于application启动类中嵌入的tomcat与部署war的tomcat冲突引起的,需要在pom.xml添加配置,来避免冲突!

    3.问题解决:

      修改pom.xml文件,添加依赖如下:

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-tomcat</artifactId>
        <scope>provided</scope>
    </dependency>
  • 相关阅读:
    【洛谷P1558】色板游戏
    【SCOI2010】序列操作
    Windows下MySQL下载安装、配置与使用
    Redis和MySQL数据同步及Redis使用场景
    python的设计模式之MVC模式
    python 面试真题
    python调用C语言
    一次跨域请求出现 OPTIONS 请求的问题及解决方法
    服务器宕机问题
    页面静态化
  • 原文地址:https://www.cnblogs.com/zs-notes/p/9360523.html
Copyright © 2011-2022 走看看