8 Replies Latest reply on Sep 18, 2012 4:01 PM by wdfink

    Communication of Two EAR (or WAR) Files

    burkaygur

      Hi! I am trying to demonstrate the new ClassLoader ability of JBoss by using the communication of two EAR (or WAR) files. In this demo, I am planning on using two applications (one is an extended version of the other - reusing its objects). Anyone can help me by giving some pointers?

       

      Thank you!

        • 1. Re: Communication of Two EAR (or WAR) Files
          burkaygur

          Any ideas?

           

          I am trying to import objects from EAR1 into EAR2, so I can create new instances without duplicating code.

          • 2. Re: Communication of Two EAR (or WAR) Files
            wdfink

            Does this quickstart helps?

            • 3. Re: Communication of Two EAR (or WAR) Files
              burkaygur

              I am looking through this quickstart to see if that is what I need. In the meantime, let me explain in more detail what I want to do:

               

              I have two separate EAR files which I started as two seperate "ear-kitchensink" quickstarts:

               

              EAR1 ----->

                   + web

                        MemberController.java

                        VenueController.java

                   + ejb

                        Member.java

                        Venue.java

               


              EAR2 ----->

                   + web

                        MemberController.java

                   + ejb

                        Member.java

               

              Now, for EAR2 I would like to extend classes  Venue.java and VenueController.java without having to copy all the code. Is that possible?

              • 4. Re: Communication of Two EAR (or WAR) Files
                wdfink

                AFAIK the only way to do so is to create a separate module and set a dependency for both EAR.

                • 5. Re: Communication of Two EAR (or WAR) Files
                  burkaygur

                  Can you elaborate on that? I am fairly new to JBoss.

                  • 6. Re: Communication of Two EAR (or WAR) Files
                    wdfink

                    You might have a look into the quickstart log4j (#44) which demonstrates how to add a reference to a module.

                     

                    A module is one (or more) simple jar archive that is located in the JBOSS/modules directory. You might add archives you want as module and add references to applications that are need it.

                    See the datasource example, there is the JDBC drived added as module.

                    • 7. Re: Communication of Two EAR (or WAR) Files
                      burkaygur

                      How can I add a jar that is already in a deployment? Let me explain how I tried to do it. I have:

                       

                      one-ear.ear

                           one-ejb.jar

                       

                      two-ear.ear

                           two-ejb.jar

                       

                      I placed a jboss-deployment-structure.xml into the top level of one-ear.ear META-INF and it is as follows:

                       

                      <?xml version="1.0" encoding="UTF-8"?>

                      <jboss-deployment-structure>

                        <deployment>

                          <dependencies>

                            <module name="deployment.two-ear.ear.two-ejb-0.0.1-SNAPSHOT.jar" />

                          </dependencies>

                        </deployment>

                      </jboss-deployment-structure>

                       

                       

                      However I am not sure it is actually importing classes from that jar, because when I try to import a class it does not work. Not sure what I am doing wrong.

                      • 8. Re: Communication of Two EAR (or WAR) Files
                        wdfink

                        You can't set a dependency to a jar in a different deployment. You need to add the jar as a module and set a dependency for boh ear's