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. 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, 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:
- For Version 5 (Base), the iiop:/// provider URL correctly resolves if the application server runs in the default instance and the default ports have not been changed. The provider URL does not resolve to the correct name server if you use a non-default instance or use an instance where the default ports are changed.
- For Version 5 Network Deployment, the iiop:/// provider URL resolves to the node agent for a federated default instance, if the default instance is federated and the default ports are in use.
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.