jQuery in Action, 3rd edition
The moose likes EJB and other Java EE Technologies and the fly likes EJB calling another EJB over a Network 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 "EJB calling another EJB over a Network" Watch "EJB calling another EJB over a Network" New topic

EJB calling another EJB over a Network

Vishnu Asha

Joined: Oct 22, 2005
Posts: 1
I have two servers one @location X and another @location Y, the connection to the Server is over the Internet. I have an J2EE application running on Tomcat or JBoss server at both the locations. I would like to have the EJB at location X make a call at Locatoin Y.
Firstly is this Possible[yes it is]?
How can I make such a call?
Please let me know with an example .
Thanks in Advance
Peer Reynders

Joined: Aug 19, 2005
Posts: 2933
HTTP-Tunneling comes to mind - higher-end servers support that right out of the box - even then its not for the faint-hearted, configuration and security-wise.

JBoss seems to have an http-invoker that can connect to MessageDrivenBeans, so that may be worth your investigation.

Firewall Tunneling using Java
Tim Cockle

Joined: Oct 25, 2005
Posts: 4
I use xdoctlet that creates the remote and local interfaces for me. Then all i do is set the jndi context on my client i.e.

Hashtable jndiSettings = new Hashtable();
jndiSettings.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
jndiSettings.put(Context.URL_PKG_PREFIXES, "org.jboss.naming rg.jnp.interfaces");
jndiSettings.put(Context.PROVIDER_URL, url);

and then get the home interface as I would if it were local(home):
mySession = MySessionUtil.getHome(jndiSettings).create();

In side the util class made by xdoclet I have...

public static alpha.MySessionHome getHome( java.util.Hashtable environment ) throws javax.naming.NamingException
// Obtain initial context
javax.naming.InitialContext initialContext = new javax.naming.InitialContext(environment);
try {
java.lang.Object objRef = initialContext.lookup(alpha.MySessionHome.JNDI_NAME);
return (alpha.MySessionHome) javax.rmi.PortableRemoteObject.narrow(objRef, alpha.MySessionHome.class);
} finally {

hope this helps
I agree. Here's the link: http://aspose.com/file-tools
subject: EJB calling another EJB over a Network
jQuery in Action, 3rd edition