我们正在将 struts 1.2.9 迁移到 strtus 2.3.28。在此过程中,我在 WEB.xml 中添加了StrutsTilesListener。尝试使用 struts 2.3.28 和 tiles-api-2.2.2 启动 Wildfly 10.1 服务器时出现以下异常。
解决此问题的任何解决方案都会有所帮助。
lib 文件夹中的罐子:
struts2-convention-plugin-2.3.28.jar
struts2-tiles-plugin-2.3.28.jar
struts2-core-2.3.28.jar
tiles-api-2.2.2.jar
tiles-core-2.2 .2.jar
tiles-request-api-1.0.1.jar
tiles-request-servlet-1.0.1.jar
tiles-servlet-2.2.2.jar
tiles-template-2.2.2.jar
WEB.xml
<web-app version="2.5" 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">
<servlet>
<servlet-name>setup</servlet-name>
<servlet-class>com.presentation.servlets.SetupServlet</servlet-class>
<init-param>
<param-name>monitoredFiles</param-name>
<param-value>monitoredfiles.properties</param-value>
</init-param>
</servlet>
<filter>
<filter-name>DispatcherFilter</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
<init-param>
<param-name>config</param-name>
<param-value>
/WEB-INF/struts-config/struts.xml,/WEB-INF/struts-config/struts-plugin.xml,/WEB-INF/struts-config/struts-user.xml</param-value>
</init-param>
</filter>
<listener>
<listener-class>org.apache.struts2.tiles.StrutsTilesListener</listener-class>
</listener>
<context-param id="struts_tiles">
<param-name>org.apache.tiles.DEFINITIONS_CONFIG</param-name>
<param-value>/WEB-INF/tiles-base-defs.xml, /WEB-INF/tiles-user-defs.xml</param-value>
</context-param>
</web-app>
控制台错误:
13:36:29,735 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC000001: Failed to start service jboss.undertow.deployment.default-server.default-host./bmt.UndertowDeploymentInfoService: org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./bmt.UndertowDeploymentInfoService: java.lang.ClassNotFoundException: org.apache.struts2.tiles.StrutsTilesListener from [Module "deployment.bmt.ear.bmt.war:main" from Service Module Loader]
at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService.createServletConfig(UndertowDeploymentInfoService.java:1079)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService.start(UndertowDeploymentInfoService.java:284)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassNotFoundException: org.apache.struts2.tiles.StrutsTilesListener from [Module "deployment.bmt.ear.bmt.war:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:198)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:363)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:351)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:93)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService.addListener(UndertowDeploymentInfoService.java:1364)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService.createServletConfig(UndertowDeploymentInfoService.java:860)