EntityManager JNDI Lookup

Discussão em 'StackOverflow' iniciado por Stack, Janeiro 26, 2021.

  1. Stack

    Stack Membro Participativo

    What is the correct JNDI string to look up this persistence unit JPA-DB that is shown on JBoss 6 Startup here:

    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:eek:rg.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:eek:rg.jnp.interfaces}


    I have tried the following and various others that I don't remember now and they all throw the NameNotFoundException:

    entityManager = (EntityManager) jndi.lookup("java:/EntityManagers/JPA-DB");
    entityManager = (EntityManager) jndi.lookup("java:comp/env/JPA-DB");
    entityManager = (EntityManager) jndi.lookup("JPA-DB");

    Continue reading...

Compartilhe esta Página