javax.persistence.PersistenceException: Unable to build entity manager factory

Hibernate JIRA | Felix Feisst | 3 years ago
  1. 0

    When specifying a dynamic model mapping (in contrast to a POJO mapping) a NullPointerException is thrown when trying to build the EntityManagerFactory. It seems that Envers is trying to load the non existent POJO class (which is null for a dynamic model mapping). Here is the stack trace: javax.persistence.PersistenceException: Unable to build entity manager factory at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:82) at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:55) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:63) ... Caused by: java.lang.NullPointerException at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:270) at org.hibernate.annotations.common.util.ReflectHelper.classForName(ReflectHelper.java:60) at org.hibernate.annotations.common.reflection.java.JavaReflectionManager.classForName(JavaReflectionManager.java:138) at org.hibernate.envers.configuration.internal.RevisionInfoConfiguration.configure(RevisionInfoConfiguration.java:324) at org.hibernate.envers.configuration.spi.AuditConfiguration.<init>(AuditConfiguration.java:119) at org.hibernate.envers.configuration.spi.AuditConfiguration.getFor(AuditConfiguration.java:180) at org.hibernate.envers.event.spi.EnversIntegrator.integrate(EnversIntegrator.java:76) at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:310) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1856) at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:854) at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:847) at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:396) at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:846) at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:74) ... 31 more

    Hibernate JIRA | 3 years ago | Felix Feisst
    javax.persistence.PersistenceException: Unable to build entity manager factory
  2. 0

    When specifying a dynamic model mapping (in contrast to a POJO mapping) a NullPointerException is thrown when trying to build the EntityManagerFactory. It seems that Envers is trying to load the non existent POJO class (which is null for a dynamic model mapping). Here is the stack trace: javax.persistence.PersistenceException: Unable to build entity manager factory at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:82) at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:55) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:63) ... Caused by: java.lang.NullPointerException at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:270) at org.hibernate.annotations.common.util.ReflectHelper.classForName(ReflectHelper.java:60) at org.hibernate.annotations.common.reflection.java.JavaReflectionManager.classForName(JavaReflectionManager.java:138) at org.hibernate.envers.configuration.internal.RevisionInfoConfiguration.configure(RevisionInfoConfiguration.java:324) at org.hibernate.envers.configuration.spi.AuditConfiguration.<init>(AuditConfiguration.java:119) at org.hibernate.envers.configuration.spi.AuditConfiguration.getFor(AuditConfiguration.java:180) at org.hibernate.envers.event.spi.EnversIntegrator.integrate(EnversIntegrator.java:76) at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:310) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1856) at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:854) at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:847) at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:396) at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:846) at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:74) ... 31 more

    Hibernate JIRA | 3 years ago | Felix Feisst
    javax.persistence.PersistenceException: Unable to build entity manager factory
  3. 0

    Tomcat and Hibernate: HibernateException: Unable to determine appropriate DataSource to use

    Stack Overflow | 2 years ago | Dharma Bellamkonda
    javax.persistence.PersistenceException: Unable to build entity manager factory
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Elastic Beanstalk Hibernate MySQL

    Stack Overflow | 2 years ago | arthurfnsc
    javax.persistence.PersistenceException: Unable to build entity manager factory
  6. 0

    Caused by: org.hibernate.exception.JDBCConnectionException: Error calling Driver#connect

    Stack Overflow | 2 years ago | daydreamer
    javax.persistence.PersistenceException: Unable to build entity manager factory

  1. tjago 1 times, last 8 months ago
5 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. javax.persistence.PersistenceException

    Unable to build entity manager factory

    at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory()
  2. org.hibernate.jpa
    HibernatePersistenceProvider.createEntityManagerFactory
    1. org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:82)
    1 frame
  3. Hibernate EJB
    HibernatePersistence.createEntityManagerFactory
    1. org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:55)
    1 frame
  4. JavaEE 7
    Persistence.createEntityManagerFactory
    1. javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:63)
    1 frame