I have used Tomcat about two months ago and it started OK. Now I'm getting this message:
SEVERE: ContainerBase.addChild: start:
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/docs]]
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:633)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1120)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1678)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
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:744)
Caused by: java.lang.NoSuchMethodError: javax.servlet.ServletContext.getSessionCookieConfig()Ljavax/servlet/SessionCookieConfig;
at org.apache.catalina.deploy.WebXml.configureContext(WebXml.java:1374)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1351)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:878)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:376)
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:5322)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 10 more
Please note the following behavior:
I get this error when I attempt to run catalina.bat. If I run Tomcat via Eclipse, it launches successfully
I downloaded the same version of Tomcat again and run it immediately without adding any webapps (to simply load the default Tomcat localhost page) but again I get this error.
As per previous similar questions, I replaced
servlet-api.jar
in apache'slib
folder, but it has made no difference
I was successfully able to launch startup.bat
recently and I don't think anything has changed. Please advise, thanks.
getSessionCookieConfig() is introduced since version 3, so this error is thrown because there is abosolutely an older version in your classpath.
I would suggest to resolve your problem:
1-make sure you update the servlet version to 3
2-try to find any dependecy of servlet-api and get rid of it
3-check your classpath for any potential dependency
4-make that /WEB-INF/lib of course doesn't contain servlet-api
5-make sure that web.xml suits the standards of servlet 3