[jboss-user] [EJB 3.0] - Best way to share entity beans across applications?

grundor do-not-reply at jboss.com
Thu Aug 7 14:27:36 EDT 2008

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? 


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4169365#4169365

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4169365

More information about the jboss-user mailing list