我在 Windows 8 操作系统中将 Tiles 与 Struts2 Web 应用程序集成在一起。我在服务器日志中收到以下错误:
java.lang.NoClassDefFoundError: org/apache/tiles/web/startup/TilesListener
java.lang.ClassNotFoundException: org.apache.tiles.web.startup.TilesListener
我使用了以下必要的罐子:
xwork-core-2.3.15.3.jar
struts2-core-2.3.15.3.jar
struts2-convention-plugin-2.3.15.3.jar
ognl-3.0.6.jar
javassist-3.11.0.GA.jar
freemarker-2.3.19.jar
commons-lang3-3.1.jar
commons-io-2.0.1.jar
commons-fileupload-1.3.jar
load-1.3.jar
asm-tree-3.3.jar
asm-commons-3.3.jar
asm-3.3.jar
tiles-api-2.0.6-sources.jar
tiles-compat-3.0.5.jar
tiles-core-2.0.6-sources.jar
tiles-jsp-3.0.5.jar
tiles-servlet-3.0.5.jar
tiles-portlet-2.1.4.jar
struts2-tiles-plugin-2.3.15.1..jar
我的web.xml
配置:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<welcome-file-list>
<welcome-file>/Login.jsp</welcome-file>
</welcome-file-list>
<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>
<context-param>
<param-name>tilesDefinitions</param-name>
<param-value>/WEB-INF/tiles.xml</param-value>
</context-param>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
</web-app>
我的tiles.xml
配置:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE tiles-definitions PUBLIC "-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN" "http://tiles.apache.org/dtds/tiles-config_2_0.dtd">
<tiles-definitions>
<definition name="BaseLayout" template="/BaseLayout.jsp">
<put-attribute name="title" value=" " />
<put-attribute name="header" value="/Header.jsp" />
<put-attribute name="menu" value="/Menu.jsp" />
<put-attribute name="body" value=" " />
<put-attribute name="footer" value="/Footer.jsp" />
</definition>
<definition name="/daywise.success.tiles" extends="BaseLayout">
<put-attribute name="body" value="/BodyDayWiseSuccess.jsp" />
</definition>
<definition name="/daywise.tiles" extends="BaseLayout">
<put-attribute name="body" value="/BodyDayWise.jsp" />
</definition>
</tiles-definitions>
我错过了什么?我已经花了一整天在谷歌搜索可能的解决方案,但没有找到正确的解决方案。