Hi everyone,
I'm trying to learn and use
Struts 2 (actually migrating from Struts 1 to 2) and I have written lots of
java and xml code, which should be working. I just can't run the application! When I try to, I get this
exception:
Caused by: Bean type class com.opensymphony.xwork2.ObjectFactory with
the name xwork has already been loaded by bean -
jar:file:/C:/Sun/AppServer/domains/domain1/applications/j2ee-apps/Extract_to_cv_2/struts2-core-2.0.11.2.jar!/struts-default.xml:30:72
- bean - jar:file:/C:/Sun/AppServer/domains/domain1/applications/j2ee-apps/Extract_to_cv_2/Extract_to_cv_2-war_war/WEB-INF/lib/struts2-core-2.0.11.2.jar!/struts-default.xml:30:72
As the exception said, I found that the struts-core-2.0.11.2.jar file
was located in two places under my application on the server. I tried
to remove the topmost copy of the file but when I tried running the
app. again I got the same exception, and found that the file had been
put back there. Then I tried to remove the struts-core.. file that was
further down, but the same thing happened! (the same exception and the
file had been returned to that location as well).
I'm using NetBeans 5.5.1 and Sun Java System Application Server 9 and
my application is an enterprise application with a web module and an
ejb module. I'm wondering whether this problem is due to that I have
the struts2 jars in both the lib directory of the ejb module and the
lib directory of the web module. This might be stupid, but I needed
the ejb module to know about the struts classes as well and didn't
know how to make them visible to the whole application.
But then again, this (having struts jars in both modules) actually
worked when I was using Struts 1.
I'm really confused about this and I'm hoping that someone can help
me! Maybe this is mostly a NetBeans issue so if someone who has used
NetBeans could answer it would be great.
I feel completely lost when it comes to this kind of things (what's
happening "behind the scenes" in NetBeans and the app. server) but I'm
willing to learn from anyone who wants to explain it to me. But please
explain it very thoroughly then.
Please help me! I'm stuck.
/Ylva