title: How to access the JNDI namespace defined in the Websphere 7.0 from outside of the container?
body: <p>I am tring to lookup the resource defined on the Websphere aplication server 7.0 from the out side of the Container with using the iiop protocol as below:</p>
  
  <p>Java code for (RMI client)Test.jar:</p>
  
  <pre><code>public static void main(String[] args){
  Hashtable&lt;Object, Object&gt; properties = new Hashtable&lt;Object, Object&gt;();
  properties.put(Context.INITIAL_CONTEXT_FACTORY, 
          "com.ibm.websphere.naming.WsnInitialContextFactory"); 
             properties.put(Context.PROVIDER_URL, "iiop://localhost:2809"); 
  InitialContext intCt;
  try {
         InitialContext initCtx = new InitialContext(properties);
         Object obj = intCt.lookup(JNDI_NAME);
       }catch (NamingException namingE) {
              System.out.println("Naming Exception occurred :");
              namingE.printStackTrace();
          }   
  }
  </code></pre>
  
  <p>Cmmand file to call the Test.jar:</p>
  
  <pre>
  set appClassPath=C:\WebSphere\AppServer7.0\deploytool\itp\plugins\com.ibm.websphere.v7_7.0.1.v20090422_1423\wasJars\naming.jar;C:\WebSphere\AppServer7.0\deploytool\itp\plugins\com.ibm.websphere.v7_7.0.1.v20090422_1423\wasJars\namingclient.jar;C:\WebSphere\AppServer7.0\properties;C:\Batch\CommandFiles\JobServer\Test.jar
  
  C:\WebSphere\AppServer7.0\java\jre\bin\java -jar -cp "%appClassPath%" C:\Batch\CommandFiles\JobServer\Test.jar %Parameters%  
  </pre>
  
  <p>NOTE : Please not that I am runnig the client on my local machin and bootstrap host is : localhost and the port is 2809.</p>
  
  <p>At the time of running the Test.jar code form the command file I am getting the following error:</p>
  
  <pre>
  javax.naming.NoInitialContextException: Failed to create InitialContext using factory specified in hashtable {java.naming.provider.url=iiop://localhost:2809, java.naming.factory.initial=com.ibm.websphere.naming.WsnInitialContextFactory} [Root exception is java.lang.NullPointerException]
      at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:243)
      at javax.naming.InitialContext.initializeDefaultInitCtx(InitialContext.java:327)
      at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:357)
      at javax.naming.InitialContext.internalInit(InitialContext.java:295)
      at javax.naming.InitialContext.(InitialContext.java:212)
      at com.uuic.ets.rmi.server.client.Client.main(Client.java:130)
  Caused by: java.lang.NullPointerException
      at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:235)
      ... 5 more
  </pre>
  
  <p>I have no idea that why this code is not able to instantiat the <code>InitialContext(Hashmap env)</code>. This same code is running in Websphere application server version 5.1 but having problem in Websphere application server version 7.0.</p>