1

因此,从我读到的内容来看,这应该很容易执行。我遵循了与创建 application.xml 文件时类似的设置。

<application>
   <display-name>test</display-name>

   <module>
      <web>
         <web-uri>foo.war</web-uri>
         <context-root>foo</context-root>
      </web>
   </module>

   <module>
      <web>
         <web-uri>bar.war</web-uri>
         <context-root>bar</context-root>
      </web>
   </module>

</application>

我已经在这个 JVM 中分别测试了这两个应用程序,它们运行良好......但是当放在一起时,我遇到了 struts 2 错误(这两个应用程序都是使用 struts 2 框架创建的),我不确定是什么失踪。错误如下

[Servlet Error]-[Filter [struts2]: could not be initialized]: Unable to load bean: type: class:com.opensymphony.xwork2.ObjectFactory - bean - wsjar:file:<my filepath>/WEB-INF/lib/struts2-core-2.0.14.jar!/struts-default.xml:30:72 

有什么想法吗?


*编辑所以我一直在阅读此错误可能是因为您在 WEB-INF/lib 目录中有冲突的 struts2 jars(或者它们在两个地方加载)。虽然我认为这不是问题,因为这些罐子在不同的 WAR 中。

4

2 回答 2

2

最简单的方法可能是更改类加载器策略:从 console applications->enterprise applications->your app->WAR class loader policy->Class loader for each WAR file in application。但尽量确保在 ear 的 WEB-INF/lib 目录中只有一组给定的 jar。您也可以使用共享库。但如果问题是由共享库引起的,您可以更改类加载器顺序applications->enterprise applications->your app->class loader order->Classes loaded with local class loader first (parent last)

于 2011-09-07T08:03:44.783 回答
0

如果您怀疑这是冲突,请打开详细类加载以查看正在加载的内容。确保您有多个类加载器(这是默认设置)。

查看详细的类加载应该会告诉您 WAS 运行时从哪里加载所需的类。

高温高压

芒鲁

于 2011-09-06T23:50:03.850 回答