title: Unknown JNDI Lookup String
body: <p>I am new to EJB concept. I have seen the following in different website :</p>
  
  <p>Sample 1:</p>
  
  <pre><code>@Stateless
  @EJB(name="audit", beanInterface=AnotherEJBLocal.class)
  public class EmployeeBean implements EmployeeServiceLocal, EmployeeServiceRemote {
    @PersistenceContext(unitName = "EmployeeService")
    private EntityManager manager;
  
    public void doAction(){
      try {
        Context ctx = new InitialContext();
        AnotherEJBLocal audit = (AnotherEJBLocal) ctx.lookup("java:comp/env/audit");
        audit.doAnother();
    } catch (NamingException e) {
        throw new EJBException(e);
    }
  
    }
  }
  </code></pre>
  
  <p>Sample 2:</p>
  
  <pre><code>public static void main(String[] a) throws Exception {
  
      EmployeeServiceRemote service = null;
      service = (EmployeeServiceRemote) new InitialContext().lookup("EmployeeBean/remote");
  
  
      service.doAction();
  
  
  
    }
  </code></pre>
  
  <p>Sample 3:</p>
  
  <pre><code>obj = ctx.lookup(ejb/CBDWebAppEAR/CBDWebApp.jar/&lt;EJB name&gt;/&lt;Remote Interface Class Name&gt;);
  </code></pre>
  
  <p>CBDWebApp is the project name in which the bean resides.</p>
  
  <p>My question is:</p>
  
  <ol>
  <li><p>What is the need &amp; MEANING of java:comp/env/audit</p></li>
  <li><p>Why same type of string is not used in case of Sample 2. I guess as
  it is a remote EJB not local.</p></li>
  <li><p>Why is the meaning of the EJB look up string in the Sample 3.</p></li>
  </ol>