java.lang.ExceptionInInitializerError

Hibernate JIRA | Sebastian Baltes | 9 years ago
  1. 0

    Transient fields are not ignored in Hibernate. I got an "Property has an unbound type" exception and found no workaround. Entity: import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Transient; @Entity public class Dummy<K> { @Id private Long id; @Transient transient private K dummyField; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public K getDummyField() { return dummyField; } public void setDummyField(K dummyField) { this.dummyField = dummyField; } } Test Code: EntityManager em = EntityManagerSingleton.get(); EntityTransaction tx = em.getTransaction(); tx.begin(); Dummy a = new Dummy(); em.persist(a); tx.commit(); Exception: java.lang.ExceptionInInitializerError at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at junit.framework.TestSuite.createTest(TestSuite.java:54) at junit.framework.TestSuite.addTestMethod(TestSuite.java:280) at junit.framework.TestSuite.<init>(TestSuite.java:140) at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestLoader.getTest(JUnit3TestLoader.java:102) at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestLoader.loadTests(JUnit3TestLoader.java:59) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:445) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) Caused by: javax.persistence.PersistenceException: org.hibernate.AnnotationException: Property de.neise.gena.model.file.Dummy.dummyField has an unbound type and no explicit target entity. Resolve this Generic usage issue or set an explicit target attribute (eg @OneToMany(target=) or use an explicit @Type at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:258) at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:120) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:51) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:33) at de.neise.gena.model.testbase.BaseTest.<clinit>(BaseTest.java:19) ... 13 more Caused by: org.hibernate.AnnotationException: Property de.neise.gena.model.file.Dummy.dummyField has an unbound type and no explicit target entity. Resolve this Generic usage issue or set an explicit target attribute (eg @OneToMany(target=) or use an explicit @Type at org.hibernate.cfg.AnnotationBinder.addElementsOfAClass(AnnotationBinder.java:993) at org.hibernate.cfg.AnnotationBinder.getElementsToProcess(AnnotationBinder.java:833) at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:645) at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:498) at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:277) at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1115) at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1269) at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:150) at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:888) at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:186) at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:246) ... 17 more

    Hibernate JIRA | 9 years ago | Sebastian Baltes
    java.lang.ExceptionInInitializerError
  2. 0

    Transient fields are not ignored in Hibernate. I got an "Property has an unbound type" exception and found no workaround. Entity: import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Transient; @Entity public class Dummy<K> { @Id private Long id; @Transient transient private K dummyField; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public K getDummyField() { return dummyField; } public void setDummyField(K dummyField) { this.dummyField = dummyField; } } Test Code: EntityManager em = EntityManagerSingleton.get(); EntityTransaction tx = em.getTransaction(); tx.begin(); Dummy a = new Dummy(); em.persist(a); tx.commit(); Exception: java.lang.ExceptionInInitializerError at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at junit.framework.TestSuite.createTest(TestSuite.java:54) at junit.framework.TestSuite.addTestMethod(TestSuite.java:280) at junit.framework.TestSuite.<init>(TestSuite.java:140) at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestLoader.getTest(JUnit3TestLoader.java:102) at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestLoader.loadTests(JUnit3TestLoader.java:59) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:445) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) Caused by: javax.persistence.PersistenceException: org.hibernate.AnnotationException: Property de.neise.gena.model.file.Dummy.dummyField has an unbound type and no explicit target entity. Resolve this Generic usage issue or set an explicit target attribute (eg @OneToMany(target=) or use an explicit @Type at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:258) at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:120) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:51) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:33) at de.neise.gena.model.testbase.BaseTest.<clinit>(BaseTest.java:19) ... 13 more Caused by: org.hibernate.AnnotationException: Property de.neise.gena.model.file.Dummy.dummyField has an unbound type and no explicit target entity. Resolve this Generic usage issue or set an explicit target attribute (eg @OneToMany(target=) or use an explicit @Type at org.hibernate.cfg.AnnotationBinder.addElementsOfAClass(AnnotationBinder.java:993) at org.hibernate.cfg.AnnotationBinder.getElementsToProcess(AnnotationBinder.java:833) at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:645) at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:498) at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:277) at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1115) at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1269) at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:150) at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:888) at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:186) at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:246) ... 17 more

    Hibernate JIRA | 9 years ago | Sebastian Baltes
    java.lang.ExceptionInInitializerError
  3. 0

    Should Hibernate be able to handle overlapping foreign keys?

    Stack Overflow | 6 years ago | Kawu
    javax.persistence.PersistenceException: [PersistenceUnit: geoinfo] Unable to configure EntityManagerFactory
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    OneToOne shared Primary Key, Pure JPA 2.0 Solution works with EclipseLink but fails with with Hibernate Provider

    Stack Overflow | 3 years ago | nirmalsingh
    javax.persistence.PersistenceException: [PersistenceUnit: users] Unable to configure EntityManagerFactory
  6. 0

    Hibernate: AnnotationException: Unknown mappedBy in ... referenced property unknown on reverse (mappedBy), bi-directional @OneToOne associations

    Stack Overflow | 6 years ago | Kawu
    javax.persistence.PersistenceException: [PersistenceUnit: persons] Unable to configure EntityManagerFactory

    4 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. org.hibernate.AnnotationException

      Property de.neise.gena.model.file.Dummy.dummyField has an unbound type and no explicit target entity. Resolve this Generic usage issue or set an explicit target attribute (eg @OneToMany(target=) or use an explicit @Type

      at org.hibernate.cfg.AnnotationBinder.addElementsOfAClass()
    2. Hibernate
      Configuration.buildMappings
      1. org.hibernate.cfg.AnnotationBinder.addElementsOfAClass(AnnotationBinder.java:993)
      2. org.hibernate.cfg.AnnotationBinder.getElementsToProcess(AnnotationBinder.java:833)
      3. org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:645)
      4. org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:498)
      5. org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:277)
      6. org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1115)
      6 frames
    3. Hibernate EJB
      HibernatePersistence.createEntityManagerFactory
      1. org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1269)
      2. org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:150)
      3. org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:888)
      4. org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:186)
      5. org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:246)
      6. org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:120)
      6 frames
    4. JavaEE 7
      Persistence.createEntityManagerFactory
      1. javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:51)
      2. javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:33)
      2 frames
    5. de.neise.gena
      BaseTest.<clinit>
      1. de.neise.gena.model.testbase.BaseTest.<clinit>(BaseTest.java:19)
      1 frame
    6. Java RT
      Constructor.newInstance
      1. sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      2. sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
      3. sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
      4. java.lang.reflect.Constructor.newInstance(Constructor.java:513)
      4 frames
    7. JUnit
      TestSuite.<init>
      1. junit.framework.TestSuite.createTest(TestSuite.java:54)
      2. junit.framework.TestSuite.addTestMethod(TestSuite.java:280)
      3. junit.framework.TestSuite.<init>(TestSuite.java:140)
      3 frames
    8. JUnit3 Runner
      RemoteTestRunner.main
      1. org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestLoader.getTest(JUnit3TestLoader.java:102)
      2. org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestLoader.loadTests(JUnit3TestLoader.java:59)
      3. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:445)
      4. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
      5. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
      6. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
      6 frames