tomcat启动报错failed to start component

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了tomcat启动报错failed to start component相关的知识,希望对你有一定的参考价值。

严重: A child container failed during start 
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/test]] 
at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:222) 
at java.util.concurrent.FutureTask.get(FutureTask.java:83) 
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1128) 
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:782) 
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1566) 
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1556) 
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) 
at java.util.concurrent.FutureTask.run(FutureTask.java:138) 
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) 
at java.lang.Thread.run(Thread.java:619) 
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/test]] 
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) 
... 7 more 
Caused by: java.lang.NoSuchMethodError: javax.servlet.ServletContext.getSessionCookieConfig()Ljavax/servlet/SessionCookieConfig; 
at org.apache.catalina.deploy.WebXml.configureContext(WebXml.java:1309) 
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1357) 
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:855) 
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:345) 
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) 
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90) 
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5161) 
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 
... 7 more 
2012-3-26 14:50:17 org.apache.catalina.core.ContainerBase startInternal 

 

解决过程:

曾经替换过tomcat中的servlet-api.jar包,导致出错。servlet版本和开发时用的版本不一致。

原因:

tomcat为其配套的servlet-api.jar不匹配或项目工程lib下有低版本的servlet-api.jar, 
tomcat7以前的这个包没有getSessionCookieConfig这个方法,7的包有这个方法, 
解决方法,删除项目工程lib文件夹的低版本的servlet-api.jar,tomcat的lib文件夹里用默认带的jar包
或者把tomcat换成6的

 































以上是关于tomcat启动报错failed to start component的主要内容,如果未能解决你的问题,请参考以下文章

tomcat启动报错failed to start component

Tomcat启动报错Server Tomcat v8.5 Server at localhost failed to start

eclipse 的 tomcat 启动报错(Server Tomcat v7.0 Server at localhost failed to start.)

关于Tomcat启动报错:One or more listeners failed to start

Springboot项目编译正常启动Unable to start embedded Tomcat报错

maven项目使用tomcat启动报错:Server Tomcat v8.5 Server at localhost failed to start