1 Reply Latest reply on Jul 23, 2007 2:29 PM by skyjbusr

    classloader in 4.2.x loading jars from two wars

    skyjbusr

      I have an ear (std.ear) with two wars (std.war, std-admin.war) in it, and I have been unable to deploy this ear to jboss-4.2 (it worked in jboss-4.0.5 and earlier versions). Both wars are using struts2 and I get the following error when jboss tries to deploy the second war:
      ERROR [[/public]] Exception starting filter struts2
      Unable to load bean: type: class:com.opensymphony.xwork2.ObjectFactory - bean - jar:file:/opt/jboss-4.2.1.GA/server/marcr-std/deploy/std.ear/std-public.war/WEB-INF/lib/struts2-core-2.0.8.jar!/struts-default.xml:8:72

      and the reason is:
      Caused by: Bean type class com.opensymphony.xwork2.ObjectFactory with the name xwork has already been loaded by bean - jar:file:/opt/jboss-4.2.1.GA/server/marcr-std/deploy/std.ear/std-admin.war/WEB-INF/lib/struts2-core-2.0.8.jar!/struts-default.xml:8:72 - bean - jar:file:/opt/jboss-4.2.1.GA/server/marcr-std/deploy/std.ear/std-public.war/WEB-INF/lib/struts2-core-2.0.8.jar!/struts-default.xml:8:72

      The problem is that it is loading the struts-default.xml from the std-admin.war (std-admin.war/WEB-INF/lib/struts2-core-2.0.8.jar!/struts-default.xml) when it is loading std.war. If I view the classpath in the jmx-console for the std.war, I see that it is loading all the jars from std-admin.war/WEB-INF/lib in addition to the jars in std.war/WEB-INF/lib.

      If I comment out either of the wars in the application.xml (so jboss only loads up one of the wars), everything works fine.