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的

 

posted @ 2017-02-13 11:56  兜儿。  阅读(3198)  评论(0编辑  收藏  举报