This content has been marked as final.
Show 1 reply
-
1. Re: Same JNDI name in multiple EAR files: Mix up?
jaikiran May 13, 2007 1:18 PM (in response to mhassel)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");