• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Remote method calls.

 
Alex George
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can somebody help me with calling ejb remote methods. I receive
ejb client jars
from other developers. They just send it to me thru email.
How can I setup the JNDI names and machine name (of the remore machine where the actual method is running)?
Do I set that up in the ejb-jar.xml or any other files? I am still a kind of new to EJB.
I really appreciate any help.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34863
369
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Alex,
You pass that info when creating a new InitialContext to do the JNDI lookup for the bean. You need to get the information for the bean provider. Or deployer if that is a different person. They will know where the remote EJB is hosted.
 
Alex George
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for the reply. If I know the machine name or ip address of the machine where the bean is running, where do I specify this?
 
Jetendra Ivaturi
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

Once you get the IP address of that machine. We have to connect to JNDI tree, In that process we have to provide the context url and jndi root directory..

Here is the code for that.
Properties env = new Properties();
env.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
env.put( Context.PROVIDER_URL, "t3://localhost:7001" );

context = new InitialContext(env);

This is how we give the context. Now call the create method, and get the instance of ejb and call the business methods.

Please do remember to set the client.jar in the class path.

Regards

Jetendra
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic