[jboss-user] [EJB/JBoss] - How to: Ejb call Ejb from different machine
kevin8941
do-not-reply at jboss.com
Wed Sep 6 15:32:32 EDT 2006
I have a sessionless ejb to call another sessionless ejb. When the two ejb are deployed in the same machine (jboss 4.0.4.GA), the call are fine, but , after I deploy in two different machine, I can't call it any more. The IP address of 192.168.2.191, is where the 2nd Ejb deployed
The way I call another ejb from one ejb is as follow:
//look up jndi in payment server machine
Hashtable<String,String> env = new Hashtable<String,String>();
env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory" );
env.put(Context.PROVIDER_URL, "jnp://192.168.2.191:1099");
env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces" );
Context ctx = new InitialContext(env);
//Object obj = ctx.lookup("java:/comp/env/ejb/PaymentEJB");
Object obj = ctx.lookup("ejb/PaymentEJB");
PaymentHome home = (PaymentHome)javax.rmi.PortableRemoteObject.narrow(obj,PaymentHome.class);
Payment payment = home.create();
resp = (HashMap<String,String>)payment.deposit(req);
Thanks
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3969847#3969847
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3969847
More information about the jboss-user
mailing list