You can use this piece of code:
// Get the initial context
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.ibm.websphere.naming.WsnInitialContextFactory");
env.put(Context.PROVIDER_URL, "corbaloc::app1:9811,:app2:9812");
Context initialContext = new InitialContext(env);
// Look up the home interface using the JNDI name
try {
java.lang.Object ejbHome =
initialContext.lookup("cell/clusters/EJBcluster/BeenThere");
This is fault tolerant, so if one process goes down, another can be used as the
naming provider, and the cluster can be accessed via the appropriate cell-based
path in the lookup.