JNDI naming conflicts


EJB programming & troubleshooting: JNDI naming conflicts

  1. JNDI naming conflicts (2 messages)


    I develop an EJB application with the following structure:
    I will at most have 2 different applications.
    One of them (AdminApp) will only deployed once and the other one (call it PlantApp) should be deployed several times. Their purpose is to manage several production plants. Each has its own J2EE app.
    As some of you already answered my question about EJB-EJB comm between different machines, I now have another problem.
    Is there an elegant way to simulate this scenario on a single machine. I am using J2EE RI 1.3.1.

    To be more precise: Let's say I have an AdminSession, an AdminEntity and a ProductEntity bean that all reside in AdminApp. In the PlantApp I also have the same ProductEntity bean along with a PlantSession an other entity bean. Now I'd like to deploy AdminApp once and PlantApp several times on my single maching. What about the conflicts between all the ProductEntity beans in the apps.
    Not to mention the other beans. I'd give ProductBean a JNDI name of 'Product'. How can I achieve (if possible at all), that the PlantApp PA1 uses it's own Product bean and not the Product bean that belongs to PlantApp PA2 or AdminApp?
    I know, they could use all the same entity, but the different apps should also use different DB resources for ProductEntity. Is there a smart way do achieve this without renaming JNDI names for every app to avoid naming conflicts.


    Threaded Messages (2)

  2. JNDI naming conflicts[ Go to top ]

    Perhaps I misunderstand what you're asking. But if you are running several instances (each with its own JNDI tree) on the same machine, each JNDI tree has a unique characteristic; that is its lookup (in this case uniqueness will be the instance's port). So, even though you have an object A in more than 1 instance on the same machine, you still can get a particular A.
  3. JNDI naming conflicts[ Go to top ]

    You need to use local name space for ejb lookup instead of JNDI look up. It should be something like java:com/env/ejb/<your ejb name>
    This will solve the name conflict