问题
I am having problems starting tomcat for some strange reason, it used to start before without a problem. The error is so long that I can't copy it completely from the command prompt. Anyone know what could be going wrong?
C:\apache-tomcat-7.0.8\bin>catalina.bat start
Using CATALINA_BASE: "C:\apache-tomcat-7.0.8"
Using CATALINA_HOME: "C:\apache-tomcat-7.0.8"
Using CATALINA_TMPDIR: "C:\apache-tomcat-7.0.8\temp"
Using JRE_HOME: "C:\Program Files (x86)\Java\jdk1.6.0_23"
Using CLASSPATH: "C:\apache-tomcat-7.0.8\bin\bootstrap.jar;C:\apache-tomca
t-7.0.8\bin\tomcat-juli.jar"
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.ja
va:1035)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.
java:291)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.StandardService.startInternal(StandardServic
e.java:443)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.
java:724)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.startup.Catalina.start(Catalina.java:620)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:304)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
12-Apr-2011 8:02:23 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory examples
12-Apr-2011 8:02:23 PM org.apache.catalina.startup.HostConfig deployDirectory
SEVERE: Error deploying web application directory examples
java.lang.NoSuchMethodError: javax.servlet.ServletContext.getSessionCookieConfig
()Ljavax/servlet/SessionCookieConfig;
at org.apache.catalina.deploy.WebXml.configureContext(WebXml.java:1281)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.jav
a:1276)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfi
g.java:874)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfi
g.java:317)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
eSupport.java:119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBa
se.java:89)
at org.apache.catalina.core.StandardContext.startInternal(StandardContex
t.java:4974)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
.java:812)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:78
7)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:607)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.jav
a:1044)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.j
ava:967)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:472
)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1302)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java
:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
eSupport.java:119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBa
se.java:89)
at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:34
3)
at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:32
3)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.ja
va:1043)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java
:774)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.ja
va:1035)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.
java:291)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.StandardService.startInternal(StandardServic
e.java:443)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.
java:724)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.startup.Catalina.start(Catalina.java:620)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:304)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
12-Apr-2011 8:02:23 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory host-manager
12-Apr-2011 8:02:23 PM org.apache.catalina.startup.HostConfig deployDirectory
SEVERE: Error deploying web application directory host-manager
java.lang.NoSuchMethodError: javax.servlet.ServletContext.getSessionCookieConfig
()Ljavax/servlet/SessionCookieConfig;
at org.apache.catalina.deploy.WebXml.configureContext(WebXml.java:1281)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.jav
a:1276)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfi
g.java:874)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfi
g.java:317)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
eSupport.java:119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBa
se.java:89)
at org.apache.catalina.core.StandardContext.startInternal(StandardContex
t.java:4974)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
.java:812)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:78
7)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:607)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.jav
a:1044)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.j
ava:967)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:472
)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1302)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java
:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
eSupport.java:119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBa
se.java:89)
at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:34
3)
at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:32
3)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.ja
va:1043)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java
:774)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.ja
va:1035)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.
java:291)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.StandardService.startInternal(StandardServic
e.java:443)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.
java:724)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.startup.Catalina.start(Catalina.java:620)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:304)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
12-Apr-2011 8:02:23 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory manager
12-Apr-2011 8:02:23 PM org.apache.catalina.startup.HostConfig deployDirectory
SEVERE: Error deploying web application directory manager
java.lang.NoSuchMethodError: javax.servlet.ServletContext.getSessionCookieConfig
()Ljavax/servlet/SessionCookieConfig;
at org.apache.catalina.deploy.WebXml.configureContext(WebXml.java:1281)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.jav
a:1276)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfi
g.java:874)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfi
g.java:317)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
eSupport.java:119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBa
se.java:89)
at org.apache.catalina.core.StandardContext.startInternal(StandardContex
t.java:4974)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
.java:812)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:78
7)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:607)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.jav
a:1044)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.j
ava:967)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:472
)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1302)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java
:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
eSupport.java:119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBa
se.java:89)
at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:34
3)
at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:32
3)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.ja
va:1043)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java
:774)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.ja
va:1035)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.
java:291)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.StandardService.startInternal(StandardServic
e.java:443)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.
java:724)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.startup.Catalina.start(Catalina.java:620)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:304)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
12-Apr-2011 8:02:23 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory ROOT
12-Apr-2011 8:02:23 PM org.apache.catalina.startup.HostConfig deployDirectory
SEVERE: Error deploying web application directory ROOT
java.lang.NoSuchMethodError: javax.servlet.ServletContext.getSessionCookieConfig
()Ljavax/servlet/SessionCookieConfig;
at org.apache.catalina.deploy.WebXml.configureContext(WebXml.java:1281)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.jav
a:1276)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfi
g.java:874)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfi
g.java:317)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
eSupport.java:119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBa
se.java:89)
at org.apache.catalina.core.StandardContext.startInternal(StandardContex
t.java:4974)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
.java:812)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:78
7)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:607)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.jav
a:1044)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.j
ava:967)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:472
)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1302)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java
:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
eSupport.java:119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBa
se.java:89)
at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:34
3)
at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:32
3)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.ja
va:1043)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java
:774)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.ja
va:1035)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.
java:291)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.StandardService.startInternal(StandardServic
e.java:443)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.
java:724)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.startup.Catalina.start(Catalina.java:620)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:304)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
12-Apr-2011 8:02:23 PM org.apache.coyote.AbstractProtocolHandler start
INFO: Starting ProtocolHandler ["http-apr-8080"]
12-Apr-2011 8:02:23 PM org.apache.coyote.AbstractProtocolHandler start
INFO: Starting ProtocolHandler ["ajp-apr-8009"]
12-Apr-2011 8:02:23 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 801 ms
回答1:
Error Message: java.lang.NoSuchMethodError: javax.servlet.ServletContext.getSessionCookieConfig()
Ljavax/servlet/SessionCookieConfig;
Symptoms: Tomcat cannot start
Probable Causes: This is a new method in Servlets 3.0
(which Tomcat 7
supports).
There is a Servlets 2.x API
is your CLASSPATH
or JDK's
extension directory.
Solution: Check your CLASSPATH
. Remove servlet-api.jar
from JDK's
extension directory if any.
Source: http://www3.ntu.edu.sg/home/ehchua/programming/howto/Tomcat_HowTo.html
回答2:
I resolved this exact error by adding the following jars to my tomcat/lib directory:
javax.persistence-2.0.0.jar
persistence-api-1.0.2.jar
You can find the latest versions here: http://mvnrepository.com/
回答3:
This can also happen if you have compiled a jar that includes it's runtime dependencies, and has a reference to an old version of the tomcat servlet-api.jar.
Then when your jar is loaded in a different version of Tomcat, the servlet api is incorrect, and it throws this error.
So check how your jar is compiled and make sure it's not including the servlet-api.jar as a dependency in some way!
来源:https://stackoverflow.com/questions/5642753/catalina-bat-start-not-working