当前位置: 首页 > 知识库问答 >
问题:

由于org.apache.catalina.LifeCycleException异常,无法在Tomcat8上启动应用程序?

阎咏思
2023-03-14

我将我的文件夹(myApp)复制到Tomcat8的webapps文件夹中。

然后我转到“Tomcat Web Application Manager”&在那里看到“/myApp”running=false。然后单击Start&发现了以下错误:

FAIL - Application at context path /myApp could not be started
FAIL - Encountered exception org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/myApp]]
 <?xml version='1.0' encoding='utf-8'?>
<tomcat-users>

  <role rolename="manager-gui"/>
  <role rolename="manager-script"/>
  <role rolename="manager-jmx"/>
  <role rolename="manager-status"/>
  <role rolename="admin"/>
  <user username="admin" password="admin" roles="admin,manager-gui,manager-script"/>

</tomcat-users>

注意:这是myApp的web.xml

    <?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    version="2.5">

    <display-name>myApp</display-name>

    <!-- Default page to serve -->
    <welcome-file-list>
        <welcome-file>myApp.html</welcome-file>
    </welcome-file-list>


    <listener>
        <listener-class>myApp.server.guice.GuiceServletConfig</listener-class>
    </listener>

    <filter>
        <filter-name>guiceFilter</filter-name>
        <filter-class>com.google.inject.servlet.GuiceFilter</filter-class>
    </filter>

    <filter-mapping>
        <filter-name>guiceFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <context-param>
    <!-- max size of the upload request -->
    <param-name>maxSize</param-name>
    <param-value>5145728</param-value>
  </context-param>
  <context-param>
    <param-name>slowUploads</param-name>
    <param-value>200</param-value>
  </context-param>

  <servlet>
    <servlet-name>uploadServlet</servlet-name>
    <!-- This is the default servlet, it puts files in session -->
    <servlet-class>myApp.server.SampleUploadServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>uploadServlet</servlet-name>
    <url-pattern>*.gupld</url-pattern>
  </servlet-mapping>


  <servlet>
    <servlet-name>SimpleCaptcha</servlet-name>
    <servlet-class>
        myApp.server.ExtendedCaptchaServlet
    </servlet-class>
    <init-param>
        <param-name>width</param-name>
        <param-value>200</param-value>
    </init-param>
    <init-param>
        <param-name>height</param-name>
        <param-value>50</param-value>
    </init-param>
  </servlet>

  <servlet-mapping>
    <servlet-name>SimpleCaptcha</servlet-name>
    <url-pattern>/SimpleCaptcha.jpg</url-pattern>
  </servlet-mapping>


</web-app>

Catalina.2014-05-09.log:

    09-May-2014 04:52:27.290 SEVERE [localhost-startStop-1] org.apache.catalina.core.ContainerBase.addChildInternal ContainerBase.addChild: start: 
 org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/myApp]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:726)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:702)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:697)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1134)
    at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1780)
    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:745)
Caused by: java.lang.LinkageError: loader constraint violation in interface itable initialization: when resolving method "javax.servlet.http.HttpServlet.service(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)V" the class loader (instance of java/net/URLClassLoader) of the current class, gwtupload/server/UploadServlet, and the class loader (instance of org/apache/catalina/loader/WebappClassLoader) for interface javax/servlet/Servlet have different Class objects for the type let/ServletResponse;)V used in the signature
    at java.lang.Class.getDeclaredFields0(Native Method)
    at java.lang.Class.privateGetDeclaredFields(Class.java:2397)
    at java.lang.Class.getDeclaredFields(Class.java:1806)
    at org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:106)
    at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(WebAnnotationSet.java:261)
    at org.apache.catalina.startup.WebAnnotationSet.loadApplicationServletAnnotations(WebAnnotationSet.java:140)
    at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:66)
    at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:332)
    at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:771)
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:303)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5058)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    ... 10 more

09-May-2014 04:52:27.305 SEVERE [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Error deploying web application directory C:\tomcat8\webapps\myApp
 java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/myApp]]
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:729)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:702)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:697)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1134)
    at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1780)
    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:745)

09-May-2014 04:52:27.321 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\tomcat8\webapps\examples
09-May-2014 04:52:28.102 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\tomcat8\webapps\host-manager
09-May-2014 04:52:28.133 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\tomcat8\webapps\manager
09-May-2014 04:52:28.274 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\tomcat8\webapps\ROOT
09-May-2014 04:52:28.336 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
09-May-2014 04:52:28.336 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
09-May-2014 04:52:28.336 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 13386 ms

共有1个答案

谢同化
2023-03-14

看来您的应用程序包含的servlet api与您的Tomcat不同。检查应用程序库文件夹中是否有servlet-api.jar并尝试删除它。如果您使用Maven将servlet-api.jar的依赖范围设置为“provided”。

 类似资料:
  • 我在启动标准Eclipse Neon IDE时遇到问题。我正在使用Javajdk 1.8.0运行Eclipse Neon 1。重新启动我的计算机后,Eclipse将无法启动(上次使用期间没有安装新的插件/软件)。我尝试删除,但它仍然无法启动。请帮助。 附言。日志的日期似乎已关闭;我不确定为什么,但这是此日志文件中唯一的。 这是

  • 当我尝试在华为P9上运行我的应用程序时,我得到了一个错误 日志: 07-04 10:42:56.045:W/System.err(955):java.lang.NullPoInterException:尝试对空对象引用调用虚拟方法“int com.huawie.lcagent.client.logCollectManager.GetUserType()”07-04 10:42:56.046:W/S

  • 我正在尝试创建一个JavaFX程序,每次我尝试运行我的代码时,我都会遇到一个异常——我不完全确定它的意思是什么。。。 我的代码: 堆栈跟踪: 任何帮助都将不胜感激, 谢谢

  • 我试图创建一个应用程序,但我一直遇到相同的运行时异常。我已经和它斗争了好几天,我不知道如何修复它。任何建议都将不胜感激!这是我在Java中的第一个相当长的项目,所以我决心解决它;只是有相当多的麻烦,我不知道如何克服这一点。

  • 我是appium的新手,目前正在尝试创建一些简单的测试。我的问题是我根本无法启动正在测试的应用程序,它唯一有效的时间是使用appium-dotnet-驱动程序解决方案中包含的演示应用程序通过github提供 https://github.com/appium/appium-dotnet-driver 我已经在我的Nexus 5和几个模拟器上尝试了2个不同的应用程序,但没有任何效果(请参阅下面的附加

  • https://github.com/liquibase/liquibase/blob/master/liquibase-core/src/main/java/liquibase/lockservice/standardlockservice.java#L334 经过调查,我怀疑这可能与我的用户丢失的某些权限有关,因为它在使用AWS RDS 12.1.0.2.v15创建的数据库上运行良好,但在前提