1 Reply Latest reply on Feb 10, 2006 4:02 PM by Jens Elkner

    NPE createEntityManagerFactory

    Jens Elkner Apprentice

      Hmm, using 4.0.4RC1 I get always a NPE when I try to create an EM factory:

      javax.persistence.PersistenceException: java.lang.NullPointerException
      at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:173)
      at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:103)
      at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:37)
      at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:27)
      at foo.CatalogImportSLSB$ImportThread.(CatalogImportSLSB.java:84)
      ...

      code snippet:

      @Stateless
      public class CatalogImportSB implements .... {
      
       class ImportThread extends Thread { ...
       private EntityManagerFactory emf;
       private EntityManager em;
       public ImportThread(CatalogImportProfile profile, byte[] data,
       String clientId)
       {
       emf = Persistence.createEntityManagerFactory("puname");
       em = emf.createEntityManager();
       ...
       }
       }
      
       @PersistenceContext(unitName="puname")
       EntityManager em;
      
       @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
       public void importCatalog(CatalogImportProfile profile, ...) {
       ...
       ImportThread it = new ImportThread(profile, data, clientId);
       it.start();
       ...
       }
      


      Any hints ?