If I have stubs running on my machine, in order to call the methods running on some other machine somewhere in the world, I would call lookup on context and call narrow on PortableRemoteObject and call create on the home object as follows: InitialContext context = new InitialContext(); Object o = context.lookup(jndiNameOfHomeObject); Home h = (Home) PortableRemoteObject.narrow( o, com.ejb.bmpHome.class); h.create(param1, param2,�.);
But how does the stub running on my client machine know where in the world is the skeleton is or where is the real method running (the machine name where the method is running). Where do I set that up in the server or where do I mention that in the program? Thanks in advance.
A. it's all in the InitialContext. Please note that an instance of the InitialContext can be created 1) with the Hashtable populated with the key/value pairs, one of these pairs would have the provider url, on which the remote class is running 2) with no arguments; all initial context variables are picked up from jndi.properties file.
Thank you for all the replies. So once I got the jar file (with the RMI code), I would have to put that in the build path, then put the jndi name in the ejb-jar.xml. But how do I map the jndi name in the ejb-jar file and the jndi properties file?
The container will take care of binding the JNDI name to its context. The JNDI properties will identify which JNDI initial context to connect to. Its for your client
Joined: Mar 23, 2007
I guess my question is if I get ejb client jars from developers sitting in the other side of the world, how do I set that up in order to call methods in them? I thing the first step is to put the jar file in the build path. Then I put the name in the deployment descriptor (In case of websphere this is ibm-ejb-jar-bnd.xmi. In case of jboss this is jboss.xml). Then where do I specify the name of the remote machine the real method is running (where the skeleton is)?