Wednesday, November 21, 2007

Creating an Initial Context to the Naming Service

This example uses the JNDI/COS naming service provider to connect to the local tnameserv.
String url = "iiop://localhost/";
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.cosnaming.CNCtxFactory");
env.put(Context.PROVIDER_URL, url);
try {
Context ctx = new InitialContext(env);
} catch (NamingException e) {
}

No comments: