Persistence.CreateEntityManagerFactory leads to an JNDI Exception in EJB 
Container
----------------------------------------------------------------------------------

                 Key: GERONIMO-3892
                 URL: https://issues.apache.org/jira/browse/GERONIMO-3892
             Project: Geronimo
          Issue Type: Bug
      Security Level: public (Regular issues)
          Components: naming, OpenEJB, persistence
    Affects Versions: 2.1, 2.0.2
         Environment: Windows XP, Linux (Ubuntu)
            Reporter: Ralf Baumhof


I have got a stateless session bean (ssb) which uses annotation 
@PersistenceUnit(unitName="Vesuv") protected EntityManagerFactory emf; This 
works fine. I can instantiate an entity manager and use it's persistence 
methods. However, the name of the persistence unit may vary in production 
dependant on the user logged on the the application. So an approach 
EntityManagerFactory emf = Persistence.CreateEntitiyManagerFactory("Vesuv") is 
much more suitable. But this statement does not work if i execute it in a class 
running in the geronimo ejb container (regardless of ssb or not). It works, if 
i execute it in a servlet in tomcat container.  The error message is: 
"PersistenceException: There was an error during JNDI lookup of the name 
"Postgres.vesuv". Postgres.vesuv is the name of the datasource which is 
attached in persistence.xml to the persistence unit "Vesuv". 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to