我正在尝试在我的 struts2 应用程序中使用 Tile 插件,但收到以下错误,
“部署期间发生错误:加载应用程序时出现异常:java.lang.IllegalStateException:ContainerBase.addChild:开始:org.apache.catalina.LifecycleException:java.lang.IllegalArgumentException:java.lang.ClassNotFoundException:org.apache.struts2。 tiles.StrutsTilesListener。有关详细信息,请参阅 server.log。”
我有以下 jar 文件:
tiles-api-3.0.1.jar
tiles-autotag-core-runtime-1.1.0.jar
tiles-compat-3.0.1.jar
tiles-core-3.0.1.jar
tiles-el-3.0.1.jar
tiles-extras-3.0.1.jar
tiles-freemarker-3.0.1.jar
tiles-jsp-3.0.1.jar
tiles-mvel-3.0.1.jar
tiles-ognl-3.0.1.jar
tiles-request-api-1.0.1.jar
tiles-request-freemarker-1.0.1.jar
tiles-request-jsp-1.0.1.jar
tiles-request-mustache-1.0.1.jar
tiles-request-servlet-1.0.1.jar
tiles-request-servlet-wildcard-1.0.1.jar
tiles-request-velocity-1.0.1.jar
tiles-servlet-3.0.1.jar
tiles-template-3.0.1.jar
tiles-velocity-3.0.1.jar
commons-beanutils-1.8.0.jar
commons-digester-2.0.jar
jcl-over-slf4j-1.5.8.jar
slf4j-api-1.5.8.jar
Web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" 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_3_0.xsd">
<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>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
Struts.xml
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<!-- Configuration for the default package. -->
<package name="default" extends="struts-default">
<result-types>
<result-type name="tiles" class="org.apache.struts2.views.tiles.TilesResult"/>
</result-types>
<action name="register">
<result type="tiles">register</result>
</action>
</package>
</struts>
我的 struts 库文件
Struts 2.3.4 Core Libraries - xwork-core-2.3.4.jar
Struts 2.3.4 Core Libraries - struts2-core-2.3.4.jar
Struts 2.3.4 Core Libraries - struts2-convention-plugin-2.3.4.jar
Struts 2.3.4 Core Libraries - ognl-3.0.5.jar
Struts 2.3.4 Core Libraries - javassist-3.11.0.GA.jar
Struts 2.3.4 Core Libraries - freemarker-2.3.19.jar
Struts 2.3.4 Core Libraries - commons-lang3-3.1.jar
Struts 2.3.4 Core Libraries - commons-io-2.0.1.jar
Struts 2.3.4 Core Libraries - commons-fileupload-1.2.2.jar
Struts 2.3.4 Core Libraries - asm-tree-3.3.jar
Struts 2.3.4 Core Libraries - asm-commons-3.3.jar
Struts 2.3.4 Core Libraries - asm-3.3.jar