2 Replies Latest reply on Nov 19, 2010 6:37 AM by bsgcic

    How to setup a common ejb for multiple ears?

    bsgcic Newbie

      After much googling and trial and error, I am hoping there are folks here who can help.

      I have multiple ears which all have some java classes that are the same for each ear with the exception of differences in package name of course.

      I use eclipse galileo and ZeroTurnaround's JRebel for rapid development which is important for my productivity.

      I would like to create a common ejb that I can have in each of the ears.

      Say I was to put all the common java classes in an ejb called com.siteA-common-ejb, then the structure that I am looking for is as follows:

        com.siteA (the war)
        com.siteA-ejb (classes specific to com-siteA)
        com.siteA-common-ejb (classes common to all ears)
        com.siteB (the war)
        com.siteB-ejb (classes specific to com-siteB)
        com.siteA-common-ejb (classes common to all ears)
        com.siteC (the war)
        com.siteC-ejb (classes specific to com-siteC)
        com.siteA-common-ejb (classes common to all ears)

      In this way, when I make a change to a class within com.siteA-common-ejb, JRebel will update all of the ears thus minimizing my development time (i,e., no copying and pasting to each ear needed). I believe that packaging and including siteA-common-EJB as a jar in each ear's library would not work with JRebel.

      Can someone please walk me through the steps (specific to eclipse where applicable) on how to accomplish this?

      Thank you,


        • 1. Re: How to setup a common ejb for multiple ears?
          Leo van den berg Master


          A bit complex to explain in a short answer and certainly of-subject, but you should look into Maven as an aditional tool for building projects. It takes a lot of time to learn, but it is really worth the effort. At the moment you have evything in place and all your dependencies figured out, building your EAR's will be a piece of cake.


          • 2. Re: How to setup a common ejb for multiple ears?
            bsgcic Newbie

            Hi Leo,

            Thank you very kindly for your help.
            Actually, I just noticed your response. I had not realized that there was one because in the past I have received automated email notifications of responses to posts in this forum but did not seem to get one this time.

            Anyway, I greatly appreciate your insight. It looks like Maven is a tool that I should be learning about. I did seem to find a solution via Eclipse Helios linking to files feature. I had spent  a significant amount of time attempting that as a solution in Eclipse Galileo but it had not worked and was relieved that it works in Helios.