title: EJB lookup with InitialContext
body: <p>I have a problem to look up a EJB hosted on a server. The server itself is an SAP environment, which is basicly a modified tomcat.</p>
  
  <p>I tried several lookupstrings starting  with </p>
  
  <pre><code>java:comp/env/ 
  </code></pre>
  
  <p>and </p>
  
  <pre><code>ejb:/ 
  </code></pre>
  
  <p>but nothing works.</p>
  
  <p>This is what the server says about the lookupstrings:</p>
  
  <pre><code>ejb:/appName=mycompany.de/reboard~report~cs, jarName=mycompany.de~reboard~report~cs.jar, beanName=com.sap.bpem.facade.api._simplified.adapted.BPMFacadeBeanSimplifiedEjb, interfaceName=com.sap.bpem.facade.api._simplified.adapted.BPMFacadeBeanSimplifiedLocal
  </code></pre>
  
  <p>and for the remote part:</p>
  
  <pre><code>ejb:/appName=mycompany.de/reboard~report~cs, jarName=mycompany.de~reboard~report~cs.jar, beanName=com.sap.bpem.facade.api._simplified.adapted.BPMFacadeBeanSimplifiedEjb, interfaceName=com.sap.bpem.facade.api._simplified.adapted.BPMFacadeBeanSimplifiedRemote
  </code></pre>
  
  <p>I tried diferent combinations of this lookup strings but all fail. I can get the Proxy object to the Bean tho by using this:</p>
  
  <pre><code>InitialContext().lookup("ejb:/com.sap.bpem.facade.api._simplified.adapted.BPMFacadeBeanSimplifiedLocal");
  </code></pre>
  
  <p>But what i need as the direct bean access.</p>
  
  <p>Here is how the Bean is defined:</p>
  
  <pre><code>@com.sap.engine.services.webservices.espbase.configuration.ann.rt.TransportBindingRT(AltPath="reboard/report/cs~ibsolution.de_com.sap.bpem.facade.api._simplified.adapted.BPMFacadeBeanSimplifiedEjb")
  @UsedReferences(srIds="05bc3ba3-fd85-4381-b6f8-f8a4734b2815, 05bc3ba3-fd85-4381-b6f8-f8a4734b2815, 05bc3ba3-fd85-4381-b6f8-f8a4734b2815", wsdlLocations="ibsolution.de~reboard~report~cs.jar#META-INF/wsdl/consumed/src/wsdl/rootwsdl_BPMFacadeBeanImplService_BPMFacadeBeanImpl.wsdl, ibsolution.de~reboard~report~cs.jar#META-INF/wsdl/consumed/src/wsdl/rootwsdl_BPMFacadeBeanImplService_BPMFacadeBeanImpl.wsdl, ibsolution.de~reboard~report~cs.jar#META-INF/wsdl/consumed/src/wsdl/rootwsdl_BPMFacadeBeanImplService_BPMFacadeBeanImpl.wsdl")
  @Stateless(name="com.sap.bpem.facade.api._simplified.adapted.BPMFacadeBeanSimplifiedEjb")
  @EJB(name="BPMBean", beanInterface=BPMFacadeBeanSimplifiedLocal.class)
  @WebService(
      portName="BPMFacadeBean_simplifiedBindingPort",
      endpointInterface="com.sap.bpem.facade.api._simplified.BPMFacadeBeanSimplified",
      serviceName="BPMFacadeBean_simplifiedBindingService",
      targetNamespace="http://api.facade.bpem.sap.com/_simplified",
      wsdlLocation="META-INF/wsdl/composed/src/wsdl/rootwsdl_importedwsdl_1_BPMFacadeBeanImplService_BPMFacadeBeanImpl_simplified.wsdl")
  public class BPMFacadeBeanSimplifiedEjb implements 
      BPMFacadeBeanSimplifiedLocal,
      BPMFacadeBeanSimplifiedRemote
  </code></pre>
  
  <p>Local Interface:</p>
  
  <pre><code>@Local
  public interface BPMFacadeBeanSimplifiedLocal
      extends com.sap.bpem.facade.api._simplified.BPMFacadeBeanSimplified {}
  </code></pre>
  
  <p>Remote Interface:</p>
  
  <pre><code>@Remote
  public interface BPMFacadeBeanSimplifiedRemote
      extends com.sap.bpem.facade.api._simplified.BPMFacadeBeanSimplified {}
  </code></pre>
  
  <p>BPMFacadeBeanSimplified Interface:</p>
  
  <pre><code>@javax.jws.WebService(name = "BPMFacadeBean_simplified", targetNamespace = "http://api.facade.bpem.sap.com/_simplified")
  @javax.jws.soap.SOAPBinding(parameterStyle = javax.jws.soap.SOAPBinding.ParameterStyle.WRAPPED, style = javax.jws.soap.SOAPBinding.Style.DOCUMENT, use = javax.jws.soap.SOAPBinding.Use.LITERAL)
  public interface BPMFacadeBeanSimplified {
  
  @javax.jws.WebMethod(operationName = "getActiveProcesses", action = "http://api.facade.bpem.sap.com/_simplified/getActiveProcesses")
  @javax.xml.ws.RequestWrapper(localName = "getActiveProcesses", targetNamespace = "http://api.facade.bpem.sap.com/", className = "com.sap.bpem.facade.api.GetActiveProcesses")
  @javax.xml.ws.ResponseWrapper(localName = "getActiveProcessesResponse", targetNamespace = "http://api.facade.bpem.sap.com/", className = "com.sap.bpem.facade.api.GetActiveProcessesResponse")
  @javax.jws.WebResult(name = "return", targetNamespace = "")
  public java.util.List&lt;com.sap.bpem.facade.api.ProcessInfo&gt; getActiveProcesses(@javax.jws.WebParam(name = "locale", targetNamespace = "") java.lang.String locale);
  
  /**
   * Java representation of web method [getProcessDescription].
   */
  @javax.jws.WebMethod(operationName = "getProcessDescription", action = "http://api.facade.bpem.sap.com/_simplified/getProcessDescription")
  @javax.xml.ws.RequestWrapper(localName = "getProcessDescription", targetNamespace = "http://api.facade.bpem.sap.com/", className = "com.sap.bpem.facade.api.GetProcessDescription")
  @javax.xml.ws.ResponseWrapper(localName = "getProcessDescriptionResponse", targetNamespace = "http://api.facade.bpem.sap.com/", className = "com.sap.bpem.facade.api.GetProcessDescriptionResponse")
  @javax.jws.WebResult(name = "return", targetNamespace = "")
  public java.lang.String getProcessDescription(@javax.jws.WebParam(name = "activeVersionId", targetNamespace = "") java.lang.String activeVersionId, @javax.jws.WebParam(name = "locale", targetNamespace = "") java.lang.String locale);
  
  }
  </code></pre>
  
  <p>What is the correct lookup string in this case? </p>
  
  <p>Thank you for your help!</p>