maven运行出现错误:Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEn

Posted 三杯两盏淡酒

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了maven运行出现错误:Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEn相关的知识,希望对你有一定的参考价值。

maven在使用tomcat插件tomcat7-maven-plugin:2.2:run运行项目,出现下面错误:

严重: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].StandardContext[]]
...
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].StandardContext[]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
    ... 6 more
Caused by: java.lang.LinkageError: loader constraint violation: loader (instance of org/apache/catalina/loader/WebappClassLoader) previously initiated loading for a different type with name "javax/servlet/ServletContext"
...
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
    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: A child container failed during start

解决方案:
将下面的依赖包从项目中删掉,因为这个servlet-api版本太低了.删掉这个依赖包,直接启动项目,如果可以启动,那就没什么问题.
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>

如果删除servlet-api提示缺少servlet-api包里的类,那就在maven仓库中找到最新版本的包,添加到pom.xml中.
或者
在idea中, File -> Project Structure ->Module -> 找到项目 ->Dependencies -> 点击右侧 "+"  -> Library..-> 拉到最底下 ->Application Server Libraries -> 添加一个tomcat的依赖.


































以上是关于maven运行出现错误:Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEn的主要内容,如果未能解决你的问题,请参考以下文章

Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory)

在使用单元测试Junit @Test时,出现错误Caused by: java.lang.UnsupportedClassVersionError

遇到问题--java--新建maven项目打jar包缺少第三方引入的包maven dependencies报错Caused by: java.lang.ClassNotFoundException

遇到问题--java--新建maven项目打jar包缺少第三方引入的包maven dependencies报错Caused by: java.lang.ClassNotFoundException

遇到问题--java--新建maven项目打jar包缺少第三方引入的包maven dependencies报错Caused by: java.lang.ClassNotFoundException

Caused by: java.security.InvalidKeyException: Illegal key size or default parameters