Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » JBoss User Help »

[jboss-user] [EJB 3.0] - Same JNDI name in multiple EAR files: mix
 up?

scott.stark@jboss.org

2007-05-07


Hello, I have the same session bean library included in multiple EAR files - they perform the same functionality, just the persistence.xml for the underlying entity beans points to different databases.

Code examples below!

The web-middle tier (a jsf backing bean) now does a jndi lookup like this

Context ctx = new InitialContext();
| DataManager) manager = (DataManager)ctx.lookup("someprefix/ejb/DataManagerBean");
|

The data I get suggest that multiple calls of this code connect to different "versions" of the same session bean - the the data comes from different databases. It seems that the manager returned can be - rather random - from any one of the deployed ear files....

The JNDI name is the same within any ear file, but can anyone suggest a way to restrict the lookups to the ear file without having to rename every bean???

Thanks!


Example:

@Remote
| public interface DataManager {
|  ...
| }
|
|
| @Stateless
| @RemoteBinding (jndiBinding="someprefix/ejb/DataManagerBean")
| public class DataManagerBean implements DataManager {
|
|  @PersistenceContext(unitName="ONEOFMANYUNITS")
|  private EntityManager em;
|
| // ...
| }




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

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4043789
_______________________________________________
jboss-user mailing list
jboss-user@(protected)
https://lists.jboss.org/mailman/listinfo/jboss-user
©2008 junlu.com - Jax Systems, LLC, U.S.A.