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

mhassel do-not-reply at jboss.com
Wed May 9 18:08:10 EDT 2007


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=4044514#4044514

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



More information about the jboss-user mailing list