Sample: Look up InitialContext with multiple hosts and ports
This example uses a CORBA object with multiple name server addresses. This graphic represents the topology used in the example:
import java.util.Hashtable; import javax.naming.Context; import javax.naming.InitialContext; Hashtable env = new Hashtable(); env.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory"); // Note: that all servers in the provider URL below are members of the same cluster. // The cluster includes three application servers -- Server1, Server2 and Server3. env.put(Context.PROVIDER_URL, "corbaloc::Server1.xyz.ibm.com:9000, :Server2.xyz.ibm.com:9000, :Server3.xyz.ibm.com:9000"); Context initialContext = new InitialContext(env);The connection is successful if any of the clustered application servers is running.