Struts2 in RAD raises an error - xwork already loaded bean

I am using RAD 7.0 to develop a Struts2 application. When I run a web application inside RAD on websphere 6.1 I get the following error:


failed to initialize]: unable to load bean: type: class: com.opensymphony.xwork2.ObjectFactory - bean - wsjar: File: / C: /workspace_test/Jars/struts2-core-2.0.11.2.jar/struts-default.xml : 30: 72 in com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register (XmlConfigurationProvider.java:208) .... more Caused: bean class type com.opensymphony.xwork2.ObjectFactory named xwork already loaded bean - wsjar : File: / C: /workspace_test/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/Struts2Demo/WEB-INF/lib/struts2-core-2.0.11.2.jar/ default .xml spreads : 30: 72 - bean - wsjar: file: / C: /workspace_test/Jars/struts2-core-2.0.11.2.jar! /Struts-default.xml: 30: 72 in com.opensymphony.xwork2.config.providers. XmlConfigurationProvider.register (XmlConfigurationProvider.java:193) ... 33 more


I understand this is happening due to 2 copies of struts2 jars. Let me explain how I set up my web project in a RAD environment.

I have a web project called "Struts2Demo". And a separate project called "JARS" which contains all the necessary jars.

All required jars for the Struts2Demo web project are configured using the "J2EE Module - Web Library Dependencies" referencing the "JARS" project.

So RAD, when loading a web application, loads jars from the JARS project as well as from the eclipse temp folder "/C:/workspace_test/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/Struts2Demo/WEB- INF / lib / "is therefore an error.

So my question is, is it possible to fix this config other than putting the required jars in WEB-INF / lib

+1


source to share


1 answer


Zero experience with RAD. But the standard practice is to put the struts (and, in general, most of the jars) in the WEB-INF / lib of every web application. The disadvantages of duplication are usually outweighed by separating classes from each library (different classloaders) among webapps, which helps avoid problems like yours.



0


source







All Articles