启动项目报错——A child container failed during start——解决Failed to start component [StandardEngine[Catalina]

Posted kkxwze

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了启动项目报错——A child container failed during start——解决Failed to start component [StandardEngine[Catalina]相关的知识,希望对你有一定的参考价值。

Caused by: org.apache.catalina.LifecycleException: A child container failed during start at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:953

技术图片

 

 

 

遇到这个问题的有很多种情况

第一种:web.xml问题,这个只要好好检查一下代码就可以解决

 <!-- 监听加载Spring -->
    <context-param>
      <param-name>contextConfigLocation</param-name>
      <param-value>classpath:applicationContext*.xml</param-value>
    </context-param>
    <listener>
       <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    <!-- 编码过滤器 -->
      <filter>
        <filter-name>Encoding</filter-name>
        <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
        <!-- <async-supported>true</async-supported> -->
        
        <init-param>
            <param-name>encoding</param-name>
            <param-value>utf-8</param-value>
        </init-param>
    </filter>
    <filter-mapping>
        <filter-name>Encoding</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>  
  
  <!-- 配置spring mvc前端控制器 -->
  <servlet>
      <servlet-name>springwebmvc</servlet-name>
      <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
      <init-param>
           <!-- 通过此参数的配置加载spring配置文件,然后初始化资源 -->
           <param-name>contextConfigLocation</param-name>
           <param-value>classpath:spring-*.xml</param-value>
           <!-- <param-value>classpath:spring-*.xml</param-value> -->
      </init-param>
      <!--让tomcat启动则加载此servlet对象,数值越小优先级越高 -->
      <load-on-startup>1</load-on-startup>
  </servlet>
  <!-- 配置Spring MVC前端控制器映射(servlet映射) -->
  <servlet-mapping>
       <servlet-name>springwebmvc</servlet-name>
       <url-pattern>/</url-pattern><!-- 除jsp拦截所有 -->
  </servlet-mapping>
  
  
  <!-- <welcome-file-list>
    <welcome-file>admin/index.jsp</welcome-file>
  </welcome-file-list> -->

网上大部分都是这个的问题

servlet-mapping中的

<url-pattern>/</url-pattern>

第二种:maven仓库下有的jar包下载不完全的问题

错误信息中,我挑选重要的一段,我在项目中需要的也是这个问题,最后在不懈的努力下解决了,特写下这篇博客为后来遇到错误的人!

Caused by: java.lang.IllegalArgumentException: java.util.zip.ZipException: invalid LOC header (bad signature)
at org.apache.catalina.webresources.JarResourceSet.initInternal(JarResourceSet.java:139)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107)
... 12 more
Caused by: java.util.zip.ZipException: invalid LOC header (bad signature)
at java.util.zip.ZipFile.read(Native Method)
at java.util.zip.ZipFile.access$1400(ZipFile.java:60)
at java.util.zip.ZipFile$ZipFileInputStream.read(ZipFile.java:717)
at java.util.zip.ZipFile$ZipFileInflaterInputStream.fill(ZipFile.java:419)
at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:158)
at sun.misc.IOUtils.readFully(IOUtils.java:65)
at java.util.jar.JarFile.getBytes(JarFile.java:425)
at java.util.jar.JarFile.getManifestFromReference(JarFile.java:193)
at java.util.jar.JarFile.getManifest(JarFile.java:180)
at org.apache.catalina.webresources.JarResourceSet.initInternal(JarResourceSet.java:137)
... 13 more

出现这类问题首先我们查看哪些包没下载完全

第一步:再pom.xml文件右键run as选择Maven test看是否报错,从报错信息中看缺失的包,如果没有报错,则进入第二步

第二步:在pom.xml文件下右键,run as选择maven build,再Goals下输入以下命令:clean install -U

技术图片

 

 运行,会有很多报错信息,在这些错误信息中找到缺失的包,只需要找到对应的目录,之后删掉那个文件夹,最后右键项目重新下载jar包

技术图片

 

 

就可以更新maven的依赖包重新下载!下载好运行即可!

 

 

以上是关于启动项目报错——A child container failed during start——解决Failed to start component [StandardEngine[Catalina]的主要内容,如果未能解决你的问题,请参考以下文章

A child container failed during start

Eclipse Maven项目报错2之A child container failed during start

Springboot启动报错:child container failed during start

Spring Boot启动提示:org.apache.catalina.LifecycleException: A child container failed during start

A child container failed during start 解决方案

严重: A child container failed during start 异常