Tomcat7.x ,jre 6 java.lang.NoSuchMethodError SessionCookieConfig

 

错误代码:

Error deploying configuration descriptor ROOT.xml
java.lang.NoSuchMethodError: javax.servlet.ServletContext.getSessionCookieConfig()Ljavax/servlet/SessionCookieConfig;
	at org.apache.catalina.deploy.WebXml.configureContext(WebXml.java:1285)
	at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1288)
	at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:875)
	at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:313)
	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
	at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:89)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4667)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:138)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:785)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:763)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:558)
	at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:674)
	at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:599)
	at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:538)
	at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1458)
	at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:338)
	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
	at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:89)
	at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1186)
	at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1340)
	at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1349)
	at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1329)
	at java.lang.Thread.run(Thread.java:662)
 

是servlet3.0的包的错误,tomcat7在运行的时候,使用的不是自己lib下面的那个api,而是使用的

这个目录下的jdk1.6.0_x/jre/lib/ext

只要把这个下面的servlet-api.jar替换成tomcat7下面的那个jar包文件,启动就正常了

你可能感兴趣的:(session)