Meaningless Drivel is fun!
The moose likes EJB and other Java EE Technologies and the fly likes Remote method calls. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Remote method calls." Watch "Remote method calls." New topic

Remote method calls.

Alex George
Ranch Hand

Joined: Mar 23, 2007
Posts: 51
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

Joined: May 26, 2003
Posts: 33132

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.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Alex George
Ranch Hand

Joined: Mar 23, 2007
Posts: 51
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

Joined: Feb 08, 2007
Posts: 159

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.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.



SCJP 1.4 & 1.5, SCWCD 1.5. Learn and Let Learn.
I agree. Here's the link:
subject: Remote method calls.
It's not a secret anymore!