1 Reply Latest reply on Aug 8, 2008 6:18 AM by jaikiran pai

    Best way to share entity beans across applications?

    Mark LoSacco Newbie

      Hi there,

      I have an application which was originally created with seamgen and has the following structure when deployed to JBossAS:

      lu-ear.ear
       lu.war
       lu-ejb.jar
       META-INF
      


      Now I have created a second application which needs to share many of the entity beans that are located in lu-ejb.jar.

      My first attempt was to create a similar structure. When deployed it looks like this:

      mylu-ear.ear
       mylu.war
       lu-ejb.jar
       META-INF
      


      So both ear's are using a copy of the lu-ejb.jar.

      What happens under this scenario is that whatever application I deploy last is the one that works. The other application gives ClassCastException errors whenever an entity bean is accessed.

      Part of our desire to split our application into two separate apps is so that in future we have ability to run on different servers.
      The main thing I would like to share across the applications is the Entity beans as app 2 will need to access app 1's database, in addition to using its own.

      Clearly I am not approaching this correctly. What is the right way to set this up?

      -Mark