title: websphere remote ejb call CORBA.OBJECT_NOT_EXIST LocateReply.UNKNOWN_OBJECT minor code: C01
body: <p>I have two local websphere 7 application servers (two profiles) on the same machine. Just a default installation with no custom configuration. One exposes a service deployed as an EJB3 session bean with ejb/edu/test/EjbFacade JNDI name.</p>
  
  <p>I wrote a simple JUnit integration test which calls a method remotely:</p>
  
  <pre><code>@Test
  public void testCall() throws Exception {
      Hashtable props = new Hashtable();
      props.put(Context.PROVIDER_URL, "corbaloc:iiop:localhost:2811");
      props.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");
      props.put("org.omg.CORBA.ORBClass", "com.ibm.CORBA.iiop.ORB");
      InitialContext initialContext = new InitialContext(props);
  
      Object obj = initialContext.lookup("cell/nodes/myNode03/servers/server1/ejb/edu/test/EjbFacade");
      EjbFacade facade = (EjbFacade) PortableRemoteObject.narrow(obj, EjbFacade.class);
      facade.doSomething();
  }
  </code></pre>
  
  <p><strong>This works fine!</strong></p>
  
  <p>Then I have a web application with an EJB reference:</p>
  
  <p>ibm-web-bnd.xmi</p>
  
  <pre><code>  &lt;ejbRefBindings xmi:id="EjbRefBinding_1386431681401" jndiName="ejb/edu/test/EjbFacade"&gt;
        &lt;bindingEjbRef href="WEB-INF/web.xml#EjbRefBinding_EjbFacade"/&gt;
    &lt;/ejbRefBindings&gt;
  </code></pre>
  
  <p>web.xml</p>
  
  <pre><code>  &lt;ejb-ref id="EjbRefBinding_EjbFacade"&gt;
        &lt;ejb-ref-name&gt;ejb/edu/test/EjbFacade&lt;/ejb-ref-name&gt;
        &lt;ejb-ref-type&gt;Session&lt;/ejb-ref-type&gt;
        &lt;home/&gt;
        &lt;remote&gt;edu.test.EjbFacade&lt;/remote&gt;
    &lt;/ejb-ref&gt;
  </code></pre>
  
  <p>And I am doing the same EJB call from a servlet using local JNDI name: <strong>java:comp/env/ejb/edu/test/EjbFacade</strong> mapped to <strong>corbaloc:iiop:localhost:2811/cell/nodes/myNode03/servers/server1/ejb/edu/test/EjbFacade</strong> in websphere admin console.</p>
  
  <p>The call fails with exception:</p>
  
  <pre><code>Caused by: javax.naming.ServiceUnavailableException: A communication failure
  occurred while attempting to obtain an initial context with the provider URL: 
  "corbaloc:iiop:localhost:2811/cell/nodes/myNode03/servers/server1/ejb/edu/test/EjbFacade". 
  Make sure that any bootstrap address information in the URL is correct and that the target 
  name server is running.  A bootstrap address with no port specification defaults to port 2809.
  Possible causes other than an incorrect bootstrap address or unavailable name server 
  include the network environment and workstation network configuration. 
  [Root exception is org.omg.CORBA.OBJECT_NOT_EXIST: LocateRequest 6 received    
  LocateReply.UNKNOWN_OBJECT  vmcid: IBM  minor code: C01  completed: No]
  </code></pre>
  
  <p><strong>What JNDI name should I configure in the WAS console? Why the same code is working under JUnit but fails from the servlet?</strong></p>