Performing a JNDI lookup on a remote EJB should always be followed by a call to PortableRemote.narrow(lookupObj, actualHomeClass) method to convert the object returned from a lookup to the EJBHome object. This is a requirement of the EJB specification in order to maintain CORBA compatibility.
The EJBLocalHome interface is meant to be used for EJBs in the same JVM as the caller. Since both the caller and the EJB are in the same JVM, you can simply cast the object returned from the JNDI lookup to an EJBLocalHome object.
The following link illustrates this concept very effectively:
Dig Deeper on Topics Archive
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.