Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EJB calling another EJB over a Network

 
Vishnu Asha
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
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
Vishnu
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
JProxy
 
Tim Cockle
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 {
initialContext.close();
}
}

hope this helps
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic