5 Replies Latest reply on May 12, 2014 3:32 PM by Wolf-Dieter Fink

    Cross dependency between ear and war file in Jboss eap 6.0

    Sanjeev Kumar Newbie

      Hi ,

       

      I have an ear file called "financial.ear" which contains libraries and  a jar file having common classes to be used by other ears.I have a war file called "partner.war" have dependency on the "financial.ear" file classes, so i have declared dependency with in the MANIFEST.MF file in "partner.war".

      Also the classes in the "financial.ear" file are dependent on some classes present in the "partner.war" file, thus making these files cross dependent and jboss is not allowing me to deploy these files.

      So I have created a common ear file with same name as "financial.ear" containing libraries,jars and "partner.war" file , however I am getting the ClassNotFoundException in jboss console. The classes with in the war file are not visible to the classes in jar file.

       

      Can any body suggest how to make the classes of war files visible to the classes of ear file.

       

      Regards

      Sanjeev

        • 1. Re: Cross dependency between ear and war file in Jboss eap 6.0
          Wolf-Dieter Fink Master

          I suppose this is the same issue as you can not access classes inside a war which is packaged in an ear file (by spec).

          Refer to Class Loading in AS7

          • 2. Re: Cross dependency between ear and war file in Jboss eap 6.0
            Sanjeev Kumar Newbie

            Hi Wolf,

             

            If we cannot access the classes inside the war, then how will I be able to solve this issue.

             

            Is there any alternate way to fix this issue.

             

            Regards

            Sanjeev

            • 3. Re: Cross dependency between ear and war file in Jboss eap 6.0
              Wolf-Dieter Fink Master

              If you have shared classes you should create a separate jar which can be added as module (AS7) or library (AS6 and former versions).

              Another option is to add the classes to both deployments

              • 4. Re: Cross dependency between ear and war file in Jboss eap 6.0
                Sanjeev Kumar Newbie

                Hi Wolf,

                 

                I have created a jar file containing all the classes of "partner.war" file and put it in the "financial.ear", so that same classes are contained in both ear and war file.

                 

                however jboss is creating two version of the same class, which is creating a confliction. I am getting following error message in the jboss console.

                 

                 

                 

                java.lang.LinkageError: loader constraint violation: when resolving method "com.hp.tiscon.eclaims.financial.webui.bean.partner.starter.recat.UploadShowStatusForm.getTitle()Lcom/hp/tiscon/eclaims/financial/webui/bean/partner/shared/TitleBean;" the class loader (instance of org/jboss/modules/ModuleClassLoader) of the current class, com/hp/tiscon/eclaims/financial/webui/action/partner/starter/PrepareUploadShowStatusAction, and the class loader (instance of org/jboss/modules/ModuleClassLoader) for resolved class, com/hp/tiscon/eclaims/financial/webui/bean/partner/starter/recat/UploadShowStatusForm, have different Class objects for the type com/hp/tiscon/eclaims/financial/webui/bean/partner/shared/TitleBean used in the signature

                com.hp.tiscon.eclaims.financial.webui.action.partner.starter.PrepareUploadShowStatusAction.execute(PrepareUploadShowStatusAction.java:86)

                org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)

                org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)

                org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)

                org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)

                javax.servlet.http.HttpServlet.service(HttpServlet.java:734)

                javax.servlet.http.HttpServlet.service(HttpServlet.java:847)

                com.hp.tiscon.eclaims.financial.webui.controller.EncodingFilter.doFilter(EncodingFilter.java:151)

                 

                 

                How can I come over this issue & get the correct object?

                 

                 

                Regards

                Sanjeev Kumar

                • 5. Re: Cross dependency between ear and war file in Jboss eap 6.0
                  Wolf-Dieter Fink Master

                  Each module and deployment use it's own class loader. If you have a class packed in two different applications/modules and use call-by-reference (i.e. for local interfaces) this will be fail if you have such references in your parameter list.

                  Refer to Class Loading in AS7

                   

                  You should pack the classes in a module and depend on it or have the app's in the same ear and add the classes to the lib directory.

                  Other option is to use remote-interfeces and use call-by-value, but this will have performance issues