11.6 Initial contexts
In WebSphere, an initial context for a name server is associated with a bootstrap host and bootstrap port. These combined values can be viewed as the address of the name server owning the initial context. To get an initial context, know the bootstrap host and port for the initial context's name server.
JNDI clients should assume the correct environment is already configured, so there is no need to explicitly set property values and pass them to the InitialContext constructor.
However, a JNDI client might need to access a name space other than the one identified in its environment. In this case, it is necessary to explicitly set the javax.naming.provider.url (provider URL) property used by the InitialContext constructor. A provider URL contains bootstrap server information that the initial context factory can use to obtain an initial context. Any property values passed directly to the InitialContext constructor take precedence over settings of those same properties found elsewhere in the environment.
Two provider URL forms can be used with WebSphere's initial context factory:
CORBA object URL
IIOP URL CORBA object URLs are more flexible than IIOP URLs and are the recommended URL format to use. CORBA object URLs are part of the OMG CosNaming Interoperable Naming Specification. The IIOP URLs are the JNDI format, but are still supported by the WebSphere initial context factory. The examples in the following sections illustrate the use of these URLs.