gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-28 23:37:12 28 4
gpt4 key购买 nike

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

然后我转到“Tomcat Web 应用程序管理器”,我在那里看到“/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]]

在此之前,Youtube 上有人指示修改 tomcat8/conf/tomcat-users.xml 如下:

 <?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>

所以我不确定问题是 tomcat-users.xml 文件中的配置问题还是其他问题。

注意:这是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 more09-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\examples09-May-2014 04:52:28.102 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\tomcat8\webapps\host-manager09-May-2014 04:52:28.133 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\tomcat8\webapps\manager09-May-2014 04:52:28.274 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\tomcat8\webapps\ROOT09-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

最佳答案

您的应用似乎包含与您的 Tomcat 不同的 servlet api。检查您的应用程序库文件夹中是否有 servlet-api.jar 并尝试将其删除。如果您使用 Maven,请将 servlet-api.jar 的依赖范围设置为“已提供”。

关于tomcat - 由于异常 org.apache.catalina.LifecycleException,无法在 Tomcat8 上启动应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23564165/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com