title: EntityManager JNDI Lookup
body: <p>What is the correct JNDI string to look up this persistence unit JPA-DB that is shown on JBoss 6 Startup here:</p>
  <pre><code>10:26:09,847 INFO  [PersistenceUnitDeployment] Starting persistence unit persistence.unit:unitName=tpar.ear/tpar-jboss-ejb3.jar#JPA-DB
  10:26:09,847 INFO  [Ejb3Configuration] Processing PersistenceUnitInfo [
          name: JPA-DB
          ...]        
  10:26:09,847 WARN  [Ejb3Configuration] Persistence provider caller does not implement the EJB3 spec correctly.PersistenceUnitInfo.getNewTempClassLoader() is null.
  ...
  ...
  10:26:10,950 INFO  [NamingHelper] JNDI InitialContext properties:{java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}
  10:26:10,950 INFO  [NamingHelper] Creating subcontext: persistence.unit:unitName=tpar.ear
  10:26:10,950 INFO  [SessionFactoryObjectFactory] Bound factory to JNDI name: persistence.unit:unitName=tpar.ear/tpar-jboss-ejb3.jar#JPA-DB
  10:26:10,950 INFO  [NamingHelper] JNDI InitialContext properties:{java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}        
  </code></pre>
  <p>I have tried the following and various others that I don't remember now and they all throw the NameNotFoundException:</p>
  <pre><code>entityManager = (EntityManager) jndi.lookup(&quot;java:/EntityManagers/JPA-DB&quot;);
  entityManager = (EntityManager) jndi.lookup(&quot;java:comp/EntityManagers/JPA-DB&quot;);
  entityManager = (EntityManager) jndi.lookup(&quot;java:comp/env/JPA-DB&quot;);
  entityManager = (EntityManager) jndi.lookup(&quot;JPA-DB&quot;);
  </code></pre>