The following are the search steps:
STEP 1:
Context context = new InitialContext():
The source context is a reference to the JNDI search service. This is similar to writing to the JNDI virtual directory tree.
STEP 2:
Object o = context.lookup("mejb"):
Here in the search we need to specify the name of the bean of what was deployed on the server to get a link to the home interface of this bean. Then we get an object of type java.lang.Object we need to pass this object to the main interface of any bean that we looked at.
STEP 3:
Home home = (Home) PortableRemoteObject.narrow(o,Home.class):
We really need to pass the object to a type, which, in our opinion, is a type. However, since this is RMI via IIOP, it seems to us that we need to use the PortableRemoteObject.narrow method, this, apparently, filters the type of the object to the actual type of the object and checks for errors.
source share