Tuesday, October 29, 2013

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.

   test
foo.war foo bar.war bar
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.
share|improve this question
 
This should work as both WARs have its own classloader. Did you place anything in WebSphere's shared folder? –  home Sep 6 '11 at 15:58
 
Which folder would that be? From my most recent stream of errors, it looks like their WEB-INF/lib & WEB-INF/classes folders are seeing each other? For instance I got an error just now saying the a struts package named 'default' was already defined in the other WAR. Also before I was getting errors that several struts related jar files had already been loaded by the other war. –  B.Z.B Sep 6 '11 at 17:26 
 
doesn't WAS come with struts libraries already? (WAS7 does, haven't worked with 6 in years so not sure). Maybe you should ditch the ones included with your WARS, see if that works. –  Renan Sep 7 '11 at 1:49
 

2 Answers

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).
share|improve this answer

No comments: