Migrate JNDI configurations

A new InitialContext object must be instantiated before a resource can be looked up in the Java Naming and Directory Interface (JNDI) name server. In WebSphere Application Server Version 4.x, you can set the java.naming.provider.url or Context.PROVIDER_URL property for the IntialContext object to iiop:/// for application components (such as servlets or enterprise beans) that run on the server. For example:

Properties props = new Properties();

props.put("java.naming.provider.url", "iiop:///");
// or props.put(Context.PROVIDER_URL, "iiop:///");

ctx = new IntialContext(props);

The way the iiop:/// provider URL is resolved has changed in WebSphere Application Server Version 5 and later. In Version 4.x, this provider URL resolves to the bootstrap host and port for the application server where the application component runs. In Version 5 and later, this provider URL resolves to the server that runs on the local host (port 2809). If you specify iiop:/// for the provider URL, it may not resolve to the correct name server. The following outlines the resolution criteria:

To correct problems that may occur, do not specify the java.naming.provider.url or Context.PROVIDER_URL properties when creating an InitialContext() object from application components that run on the server. For example:

ctx = new IntialContext();

The provider URL is then automatically resolved to the name server that runs in the local application server process.