[jboss-user] [Clustering/JBoss] - Re: JBoss clustering - ejb lookup using HA-JNDI problem
shribala
do-not-reply at jboss.com
Tue May 29 07:18:14 EDT 2007
Here is the client program for the same..
import javax.naming.Context;
import javax.naming.*;
import javax.rmi.*;
import java.util.*;
import com.arbitron.ppm.ops.sampling.*;
class CalculatorClient {
public static void main(String args[]) throws Exception {
CalculatorClient t = new CalculatorClient();
t.go();
}
public void go() throws Exception {
Context ctx = getContextExternalClient();
CalculatorHome calculatorHome = (CalculatorHome) PortableRemoteObject.narrow(ctx.lookup("Calculator"), CalculatorHome.class);
Calculator calculator = calculatorHome.create();
String answer = calculator.add(234, 555);
System.out.println("answer : "+ answer);
}
private Context getContextExternalClient() throws Exception {
Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
p.put(Context.PROVIDER_URL, "jnp://10.239.20.193:1100");
p.put(Context.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interfaces");
Context ctx = new InitialContext(p);
return ctx;
}
}
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4049259#4049259
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4049259
More information about the jboss-user
mailing list