[jboss-dev-forums] [Design of EJB 3.0] - Default JNDI naming scheme in EJB3.0 and possible conflicts

jaikiran do-not-reply at jboss.com
Sat Oct 18 08:26:10 EDT 2008


The current default jndi binding scheme http://www.jboss.org/community/docs/DOC-9569 doesn't take into account the module name of the EJB. For example, if i have an ear named MyApp.ear containing 2 jar files First.jar and Second.jar and both containing a bean implementation AppManagerBean:

First.jar:


  | package org.myapp.first.impl;
  | 
  | @Stateless 
  | @Remote (org.myapp.first.AppManager.class)
  | public class AppManagerBean implements org.myapp.first.AppManager {
  | 
  | public String getVersion() {
  | 		return "1.0";
  | 	}
  | 
  | 
  | }
  | 

Second.jar

package org.myapp.second.impl;
  | 
  | 
  | @Stateless 
  | @Remote (org.myapp.second.AppManager.class)
  | public class AppManagerBean implements org.myapp.second.AppManager {
  | public String getVersion() {
  | 		return "2.0";
  | 	}
  | 
  | }
  | 

Then as per the default JNDI naming scheme both these beans will resolve to MyApp/AppManagerBean/remote. From what i see in the current version, only one bean (the first one) gets bound to the JNDI and the other bean does not get bound:

+- MyApp (class: org.jnp.interfaces.NamingContext)
  |   |   +- AppManagerBean (class: org.jnp.interfaces.NamingContext)
  |   |   |   +- remote (class: Proxy for: org.myapp.first.AppManager)
  |   |   |   +- remote-org.myapp.first.AppManager (class: Proxy for: org.myapp.first.AppManager)
  | 

Shouldn't we be logging a WARN message in the logs letting the user know of this conflict?

P.S: EJB3.1 spec seems to address this with the global jndi name scheme which results in a unique jndi name in these cases.
  

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

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



More information about the jboss-dev-forums mailing list