4 Replies Latest reply on Mar 21, 2014 3:10 AM by hasnain raza

    Dependency specification across Multiple EARs

    Mandar Kulkarni Newbie

      I have a couple of EARs deployed in JBoss 7.

       

      App1.ear
      |
      | _ _ lib
      |       |_ datamodel.jar
      |
      | _ _ myejb.jar
      | _ _ myservicesejb.jar

       

      App2.ear
      |
      |     
      | _ _ myejb2.jar
      | _ _ myweb.war

       

      1) My App2.ear references classes from App1.ear(Both EJB as well as datamodel).
      2) The WAR file in App2.ear also references everything from App1.ear as well as EJBs in App2/myejb2.jar.

      3) I have specified isolation to false so that dependencies are shared among deployments.

                <ear-subdeployments-isolated>false</ear-subdeployments-isolated>

      4) If I have following "jboss-deployment-structure.xml" in "App2.ear/META-INF",

       

      <?xml version="1.0" encoding="UTF-8"?>
      <jboss-deployment-structure>
        <!-- By default, we'll make all artifacts in this ear visible to each other by setting isolation to false -->
        <ear-subdeployments-isolated>false</ear-subdeployments-isolated>
        <deployment>
          <exclusions>
          </exclusions>
          <dependencies>
            <module name="deployment.App1.ear"> <!-- I hope it will get me everything in EAR/lib -->
        <exports filter="*/**"/>
         </module>
         <module name="deployment.App1.ear.myejb.jar">
        <exports filter="*/**"/>
         </module>  
         <module name="deployment.App1.ear.myservicesejb.jar">
        <exports filter="*/**"/>
         </module>
          </dependencies>
        </deployment>
      </jboss-deployment-structure>

       

      Will all the dependencies from App1.ear be available to every module in App2.ear ?

      Since I have added "jboss-deployment-structure.xml" only in App2.ear/META-INF", I suspect if these dependencies will be propagated to my myejb2.jar and myweb.war. Please confirm.(Isn't that the job of 'export' in dployment XML?)

       

      Currently, I am getting an exception indicating that myeb2.jar fails to deploy as it is not able to find a class from App1.ear/datamodel.jar.

       

      Can someone elaborate more on the exception "(DeploymentScanner-threads - 1) JBAS014654: Composite operation was rolled back" ?

        • 1. Re: Dependency specification across Multiple EARs
          Stephen Coy Master

          Why do you need two EAR files?

           

          It seems like all your problems would be resolved by using a single EAR.

          • 2. Re: Dependency specification across Multiple EARs
            Mandar Kulkarni Newbie

            App1.ear is a library.It is used by several other applications.It also exposes other webservices used by thirdparty users.

            • 3. Re: Dependency specification across Multiple EARs
              Mandar Kulkarni Newbie

              Here is the solution :

               

              <?xml version="1.0" encoding="UTF-8"?>
              <jboss-deployment-structure>
                <!-- By default, we'll make all artifacts in this ear visible to each other by setting isolation to false -->
                <ear-subdeployments-isolated>false</ear-subdeployments-isolated>
                <deployment>  
                  <dependencies>
                    <module name="deployment.App1.ear" export="true"/> <!-- I hope it will get me everything in EAR/lib -->
                    <module name="deployment.App1.ear.myejb.jar" export="true" />
                    <module name="deployment.App1.ear.myservicesejb.jar" export="true">  
                  </dependencies>
                </deployment>
              </jboss-deployment-structure>

              • 4. Re: Dependency specification across Multiple EARs
                hasnain raza Newbie

                Hi,

                 

                I am having similar type of issue, my scenario is :

                 

                App1.ear
                | _ _ myejb.jar
                | _ _ myservicesejb.jar

                 

                App2.ear
                | _ _ processEngine.jar

                 

                App2.ear --> ProcessEngine.jar sends a request and App1.ear --> ejb class consume it, but ejb class cant find the classes from App2.ear --> processEngine.jar

                 

                App2.ear demployment structure :

                 

                <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">

                  <ear-subdeployments-isolated>false</ear-subdeployments-isolated>

                  <deployment>

                  <dependencies>

                            <module name="deployment.App1.ear.ejb.jar" export="true"/>

                  </dependencies>

                  </deployment>

                </jboss-deployment-structure>

                 

                App1.ear demployment structure :

                 

                <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">

                  <ear-subdeployments-isolated>false</ear-subdeployments-isolated>

                  <deployment>

                  <dependencies>

                            <module name="deployment.App2.ear.vProcessEngine.jar" export="true"/>

                  </dependencies>

                  </deployment>

                </jboss-deployment-structure>

                 

                When deploying both ears i got moduleNotFound exception from App1 ear.