当我尝试在tomcat上部署项目时遇到此问题。我已经检查过Tomcat版本的编译版和JVM都是一样的......
不过,我无法弄清楚为什么会发生这个错误...
来自控制台的错误信息:
ContainerBase.addChild:start: org.apache.catalina.LifecycleException:无法启动组件[StandardEngine [Catalina] .StandardHost [localhost] .StandardContext [/ AddressBookBeta]] 在org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:153) 在org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725) 在org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701) 在org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717) 在org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:587) 在org.apache.catalina.startup.HostConfig $ DeployDescriptor.run(HostConfig.java:1798) at java.util.concurrent.Executors $ RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) 在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:617) 在java.lang.Thread.run(Thread.java:745) 引起:java.lang.NoClassDefFoundError:org / apache / tiles / request / ApplicationContext at java.lang.Class.getDeclaredFields0(Native Method) at java.lang.Class.privateGetDeclaredFields(Class.java:2583) at java.lang.Class.getDeclaredFields(Class.java:1916) 在org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:106) at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(WebAnnotationSet.java:256) at org.apache.catalina.startup.WebAnnotationSet.loadApplicationListenerAnnotations(WebAnnotationSet.java:86) 在org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:63) 在org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:335) 在org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:782) 在org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:306) 在org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:95) 在org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5171) 在org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) ......还有10个 引起:java.lang.ClassNotFoundException:org.apache.tiles.request.ApplicationContext 在org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1305) 在org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1139) ......还有24个
org.apache.catalina.startup.HostConfig deployDescriptor 部署配置描述符时出错/Users/ChangGuoxuan/Desktop/TemporaryFiles/EclipseWorkspace/apache-tomcat-8.0.35/conf/Catalina/localhost/AddressBookBeta.xml java.lang.IllegalStateException:ContainerBase.addChild:start:org.apache.catalina.LifecycleException:无法启动组件 [StandardEngine [卡塔利娜] .StandardHost [本地主机] .StandardContext [/ AddressBookBeta]] 在org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:729) 在org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701) 在org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717) 在org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:587) 在org.apache.catalina.startup.HostConfig $ DeployDescriptor.run(HostConfig.java:1798) at java.util.concurrent.Executors $ RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) 在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:617) 在java.lang.Thread.run(Thread.java:745)
这是我的web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
id="WebApp_ID" version="3.1">
<display-name>AddressBookBeta</display-name>
<context-param>
<param-name>org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG</param-name>
<param-value>/WEB-INF/tiles.xml</param-value>
</context-param>
<listener>
<listener-class>org.apache.struts2.tiles.StrutsTilesListener</listener-class>
</listener>
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>/main/home.jsp</welcome-file>
</welcome-file-list>
</web-app>
这是struts.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>
<constant name="struts.devMode" value="false"/>
<package name="menuDefault" extends="struts-default">
<action name="*Menu"
class="com.prj.action.MenuAction" method="{1}Menu">
<result name="home">home.jsp</result>
</action>
</package>
<package name="userDefault" extends="struts-default">
<result-types>
<result-type name="tiles"
class="org.apache.struts2.views.tiles.TilesResult"/>
</result-types>
<action name="loginUser" class="com.prj.action.UserAction" method="validateUser">
<result name="success">home.jsp</result>
<result name="login">/main/login.jsp</result>
</action>
<action name="registerUser" class="com.prj.action.UserAction" method="registerUser">
<result name="success">/main/register.jsp</result>
</action>
</package>
</struts>
我是struts2的新手,所以有什么想法吗?