0

我正在使用 Wildfly 并将 Struts2 部署为模块。我将我的 project.war 文件部署到独立/部署中。project.war/WEB-INF/lib 中有一个 project-web.jar 文件,其中包含我的 Struts2 操作。我正在使用约定插件。在我的 struts2.xml 我有以下内容:

<constant name="struts.convention.action.includeJars" value=".*?/project-web.*?jar(!/)?"/>
<constant name="struts.convention.exclude.parentClassLoader" value="true" />
<constant name="struts.convention.action.fileProtocols" value="file,jar,zip"/>

我得到的错误包括

2019-11-26 13:21:01,511 WARN  [com.opensymphony.xwork2.util.fs.DefaultFileManager] (default task-6) Could not normalize URL [vfs:.../wildfly-10.1.0.Final/bin/content/project-war-0.0.1.war] to file protocol!
2019-11-26 13:21:01,520 WARN  [org.apache.struts2.convention.PackageBasedActionConfigBuilder] (default task-6) The includeJars pattern [.*?/project-web.*?jar(!/)?] did not match any jars in the classpath
2019-11-26 13:21:01,523 ERROR [com.opensymphony.xwork2.util.ResolverUtil] (default task-6) Could not search jar file '...\wildfly-10.1.0.Final\bin\content\project-0.0.1.war\WEB-INF\lib\project-web-0.0.1.jar\com\company\project\actions' for classes matching criteria: org.apache.struts2.config.ClasspathPackageProvider$1@606e8501 due to an IOException: java.io.FileNotFoundException: ...\wildfly-10.1.0.Final\bin\content\project-0.0.1.war\WEB-INF\lib\project-web-0.0.1.jar\com\company\project\actions (The system cannot find the path specified)

虽然 Wildfly 中没有 bin\content 文件夹,但我发现它与 JBoss vfs 有关。

请注意,当我使用 project.war 而不是作为模块部署 Struts2 时,webapp 可以正常工作。

为什么 Struts2 找不到我的动作?

4

1 回答 1

0

似乎早期版本的 Struts2 在 JBoss 的 VFS 上存在问题。我从 2.3.24 升级到 2.5.20,这似乎已经让我超越了这一点。

于 2020-01-06T18:48:25.003 回答