WAS 6.1 - 在一个 EAR 中部署多个 WAR
因此,从我读到的内容来看,执行起来应该非常简单。我在创建 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 jar 冲突(或者它们加载在两个地方)而引起的。尽管我认为这不会成为问题,因为这些罐子处于不同的战争中。
So from what I read this should be pretty simple to execute.. I've followed a similar setup as seen here in creating my application.xml file.
<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>
I've tested both of these apps separately inside this JVM and they have worked fine... however when placed together I am getting a struts 2 error (both apps have been created utilizing the struts 2 framework), and I am unsure what is missing. The error is as follows
[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
Any thoughts?
*Edit
So I've been reading this error can be caused when you have conflicting struts2 jars in the WEB-INF/lib directory (or they are loaded in two places). Though I thought this couldnt be an issue since these jars are in different WARs.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
最简单的方法可能是更改类加载器策略:从控制台
应用程序 -> 企业应用程序 -> 您的应用程序 -> WAR 类加载器策略 -> 应用程序中每个 WAR 文件的类加载器
。但请尝试确保耳朵的 WEB-INF/lib 目录中只有一组给定的 jar。您也可以使用共享库。但是,如果问题是由共享库引起的,您可以更改类加载器顺序应用程序->企业应用程序->您的应用程序->类加载器顺序->首先使用本地类加载器加载的类(最后是父级)< /代码>。
The simplest way may be changing classloader policy: from console
applications->enterprise applications->your app->WAR class loader policy->Class loader for each WAR file in application
. But try to assure that there is only one set of given jars in ears' WEB-INF/lib dir. You can use shared libs also. But if the problem is caused by shared libs you can change class loader orderapplications->enterprise applications->your app->class loader order->Classes loaded with local class loader first (parent last)
.如果您怀疑这是冲突,请打开详细类加载以查看正在加载的内容。确保您有多个类加载器(这是默认设置)。
查看详细的类加载应该可以告诉您 WAS 运行时从何处加载所需的类。
HTH
曼格鲁
If you suspect it is the conflict, turn on verbose classloading to see what is being loaded. Ensure that you have multiple classloaders (which is the default).
Looking at the verbose classloading should tell you where the required classes are being loaded from by the WAS run time.
HTH
Manglu