[jboss-user] [JNDI/Naming/Network] - Re: Same JNDI name in multiple EAR files: Mix up?

jaikiran do-not-reply at jboss.com
Sun May 13 13:18:13 EDT 2007


 anonymous wrote : but can anyone suggest a way to restrict the lookups to the ear file without having to rename every bean??? 

How about adding a jboss.xml file to each of the application and specifying a different jndi name for the beans in each application? Something like:

in jboss.xml of app1:

<ejb-name>DataManagerBean</ejb-name>
  | <jndi-name>app1/ejb/DataManagerBean</jndi-name>
  | 

in jboss.xml of app2:

<ejb-name>DataManagerBean</ejb-name>
  | <jndi-name>app2/ejb/DataManagerBean</jndi-name>
  | 

Ofcourse, you would have to change the code where the lookup of the bean is happening.

String appName = getAppName();//implement some logic to pickup the appName from a properties file or the env-entry
  | Context ctx = new InitialContext();
  | DataManager) manager = (DataManager)ctx.lookup(appName + "/ejb/DataManagerBean");

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

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



More information about the jboss-user mailing list