aspose file tools*
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
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Remote method calls." Watch "Remote method calls." New topic
Author

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
Marshal

Joined: May 26, 2003
Posts: 31079
    
163

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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, 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
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


SCJP 1.4 & 1.5, SCWCD 1.5. Learn and Let Learn.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Remote method calls.