catalina.bat开始不工作

时间:2011-04-12 23:22:38

标签: java tomcat servlets nosuchmethoderror

由于某些奇怪的原因,我在启动tomcat时遇到了问题 开始之前没有问题。错误很长,我无法复制它 完全来自命令提示符。有人知道会出现什么问题吗?

    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

3 个答案:

答案 0 :(得分:11)

Error Message: java.lang.NoSuchMethodError: javax.servlet.ServletContext.getSessionCookieConfig()
Ljavax/servlet/SessionCookieConfig;

症状:Tomcat无法启动

可能原因:这是Servlets 3.0中的一种新方法(Tomcat 7支持)。     Servlets 2.x APICLASSPATH扩展目录中有JDK's。 解决方案:检查您的CLASSPATH。如果有,请从servlet-api.jar扩展程序目录中删除JDK's

来源:http://www3.ntu.edu.sg/home/ehchua/programming/howto/Tomcat_HowTo.html

答案 1 :(得分:1)

我通过将以下jar添加到我的tomcat / lib目录来解决了这个确切的错误:

javax.persistence-2.0.0.jar

持久性的API-1.0.2.jar

您可以在此处找到最新版本:http://mvnrepository.com/

答案 2 :(得分:0)

如果您编译了一个包含它的运行时依赖项的jar,并且引用了旧版本的tomcat servlet-api.jar,也会发生这种情况。

然后当你的jar加载到不同版本的Tomcat中时,servlet api不正确,并抛出此错误。

那么检查你的jar是如何编译的,并确保它不以某种方式将servlet-api.jar作为依赖包括在内!