这是我尝试在Tomcat 8.0上运行Struts应用程序时遇到的错误。
之后,我使用Dynamic Web项目的基本过程配置了应用程序,然后在应用程序构建路径和Web部署程序集中包含了Struts库。
这是我的 web.xml :
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>Struts(XML Based)</display-name>
<!-- Declaration of the Struts 2 filter. Since our entire web application will be a Struts 2
application, we will not have any other servlets or filters. Of course, real Struts 2
applications may also have other servlets or filters, but since we are doing only Struts 2
stuff in this example, we need only define the Struts 2 filter. -->
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
</web-app>
这是异常和堆栈跟踪:
java.util.concurrent.executionException: org.apache.catalina.lifecycleexception:无法启动组件 [standardengine [catalina] .standardhost [localhost] .standardcontext [/ struts]] 在java.util.concurrent.futuretask.report(未知来源)在 java.util.concurrent.futuretask.get(未知来源),网址为 org.apache.catalina.core.containerbase.startinternal(containerbase.java:945) 在 org.apache.catalina.core.standardhost.startinternal(standardhost.java:871) 在 org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:145) 在 org.apache.catalina.core.containerbase $ startchild.call(containerbase.java:1410) 在 org.apache.catalina.core.containerbase $ startchild.call(containerbase.java:1400) 在java.util.concurrent.futuretask.run(未知来源)在 java.util.concurrent.threadpoolexecutor.runworker(未知来源)在 java.util.concurrent.threadpoolexecutor $ worker.run(未知源),位于 java.lang.thread.run(未知来源)由以下原因引起: org.apache.catalina.lifecycleexception:无法启动组件 [standardengine [catalina] .standardhost [localhost] .standardcontext [/ struts]] 在 org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:162) ... 6多由以下原因引起:java.lang.noclassdeffounderror: lcom / opensymphony / xwork2 / util / logging / logger;在 java.lang.class.getdeclaredfields0(本机方法)位于 java.lang.class.privategetdeclaredfields(未知来源)位于 java.lang.class.getdeclaredfields(未知来源),网址为 org.apache.catalina.util.introspection.getdeclaredfields(introspection.java:106) 在 org.apache.catalina.startup.webannotationset.loadfieldsannotation(webannotationset.java:267) 在 org.apache.catalina.startup.webannotationset.loadapplicationfilterannotations(webannotationset.java:107) 在 org.apache.catalina.startup.webannotationset.loadapplicationannotations(webannotationset.java:66) 在 org.apache.catalina.startup.contextconfig.applicationannotationsconfig(contextconfig.java:336) 在 org.apache.catalina.startup.contextconfig.configurestart(contextconfig.java:776) 在org.apache.catalina.startup.conte