aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes JNDI lookup of local and remote home interfaces Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "JNDI lookup of local and remote home interfaces" Watch "JNDI lookup of local and remote home interfaces" New topic
Author

JNDI lookup of local and remote home interfaces

Naveen Sampra
Ranch Hand

Joined: Jun 11, 2003
Posts: 70
EJB2.0 is supposed to support dual-role beans, where both a local and a remote interface are present in the same bean for maximum flexibility.
But when you do the JNDI lookup to locate the bean, you can create JNDI to locate only one type, i.e home or remote. So, if I have an EJB client that is deployed locally, but wants to use the local interface(on one occasion) AND remote interface(on another occasion) how do you configure the JNDI for the bean to do both.
Can anyone help me with this.
Sergiu Truta
Ranch Hand

Joined: Dec 16, 2003
Posts: 121
You simply use different JNDI names for the interfaces (i.e. "BeanLocal" and "BeanRemote") and use the appropriate one when looking for the interface you want.
Here's some sample from one deployment descriptor of mine:
<session>
<ejb-name>DepartmentManager</ejb-name>
<jndi-name>DepartmentManager</jndi-name>
<local-jndi-name>DepartmentManagerLocal</local-jndi-name>
</session>
When I want to use the local interface I lookup for the "DepartmentManagerLocal" home interface, and when I want to use the bean remotely I lookup for the "DepartmentManager" home interface.
Hope it's all clear now.


...watch me...as I'm walking the path...
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30762
    
156

Naveen,
What IDE are you using? The JNDI setup for one of the interfaces may be "hidden" somewhere.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
wood burning stoves
 
subject: JNDI lookup of local and remote home interfaces