Tech > InitialContext

Typical Values for J2EE Initial Context

Platform                                     INITIAL_CONTEXT_FACTORY                              PROVIDER_URL                                   URL_PKG_PREFIXES                           Comment
-------------------------------------------- ---------------------------------------------------- ---------------------------------------------- ------------------------------------------ -----------
JBoss  3.0.7                                 org.jnp.interfaces.NamingContextFactory              jnp://host:1099                                org.jboss.naming:org.jnp.interfaces
JRun 4.0                                     jrun.naming.JRunContextFactory                       host:2909
Sun One 7.0                                  com.sun.jndi.cosnaming.CNCtxFactory                  iiop://host:3700
Weblogic 7.0                                 weblogic.jndi.WLInitialContextFactory                t3://host:7001
WebSphere 5.0                                com.ibm.websphere.naming.WsnInitialContextFactory    iiop://host:2809/                              Note: See note in "WebSphere" section
WebSphere 5.0 alternate                      com.ibm.websphere.naming.WsnInitialContextFactory    corbaloc:iiop:host:2809                        e.g. corbaloc:iiop:10.10.10.1:2809
WebSphere 5.0 multiple addresses             com.ibm.websphere.naming.WsnInitialContextFactory    corbaloc::host1:2809,:host2:2809,:host3:2809
WebSphere 5.0 from non-WebSphere environment com.someone.else.naming.AnotherInitialContextFactory corbaname:iiop:host:2809/NameServiceServerRoot

jndi.properties examples

Make sure intended jndi.properties file is the first one to be found on the classpath. Default versions are very likely to be in jar files on your classpath.

JBoss

java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
java.naming.provider.url=localhost

WebSphere

java.naming.factory.initial=com.ibm.websphere.naming.WsnInitialContextFactory
java.naming.provider.url=iiop://localhost:2809

WebSphere Note: You probably need to use a host name rather than an IP address. Whilst you can use an IP address to hit the server, somewhere along the line the client seems to retrieve and attempt to use the host name from the name server. I guess you need to either alter the name server configuration to use IP address or change your client environment so that it can resolve the host name. (Update DNS entry, or add to you hosts file).

To see what port WebSphere Application Server 5 is listening on, go to the adminstrative console and select 'Application Servers -> server1 -> End Points -> BOOTSTRAP_ADDRESS'.

Tomcat

As at the time of writing, it is not possible to directly access Tomcat's JNDI properties from outside of Tomcat.

-- Frank Dean - 28 Feb 2008


-- Frank Dean - 02 Sep 2003

Related Topics: DevelopmentSetup, JbossHintsAndTips, WebSphere