java.lang.ExceptionInInitializerError

Hibernate JIRA | Adi | 9 years ago
  1. 0

    IF the name of the orm.xml is anything different, then Hibernate is not loading the orm file. Following is the error I am getting: java.lang.ExceptionInInitializerError at com.iChieve.domain.entity.ProductCategoryUnitTest.testSave(ProductCategoryUnitTest.java:16) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at junit.framework.TestCase.runTest(TestCase.java:154) at junit.framework.TestCase.runBare(TestCase.java:127) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) 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: [PersistenceUnit: simpleJPA-PersistenceUnit] Unable to find XML mapping file in classpath: /META-INF/myorm.xml at org.hibernate.ejb.Ejb3Configuration.addClassesToSessionFactory(Ejb3Configuration.java:914) at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:772) at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:183) at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:240) 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 com.iChieve.dao.EntityManagerHelper.<clinit>(EntityManagerHelper.java:20) ... 17 more

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

    IF the name of the orm.xml is anything different, then Hibernate is not loading the orm file. Following is the error I am getting: java.lang.ExceptionInInitializerError at com.iChieve.domain.entity.ProductCategoryUnitTest.testSave(ProductCategoryUnitTest.java:16) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at junit.framework.TestCase.runTest(TestCase.java:154) at junit.framework.TestCase.runBare(TestCase.java:127) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) 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: [PersistenceUnit: simpleJPA-PersistenceUnit] Unable to find XML mapping file in classpath: /META-INF/myorm.xml at org.hibernate.ejb.Ejb3Configuration.addClassesToSessionFactory(Ejb3Configuration.java:914) at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:772) at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:183) at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:240) 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 com.iChieve.dao.EntityManagerHelper.<clinit>(EntityManagerHelper.java:20) ... 17 more

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

    Play2.11 Play can not find the model class but I can run pure JPA Junit test properly, Please come to help, thanks

    Stack Overflow | 3 years ago | LWang
    javax.persistence.PersistenceException: [PersistenceUnit: DEVUnit] class or package not found
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    About using MySQL Database

    GitHub | 3 years ago | romaar
    javax.persistence.PersistenceException: [PersistenceUnit: release] Unable to build EntityManagerFactory
  6. 0

    Remote procedure call error

    GitHub | 2 years ago | MikeVienna
    javax.persistence.PersistenceException: [PersistenceUnit: release] Unable to build 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. javax.persistence.PersistenceException

      [PersistenceUnit: simpleJPA-PersistenceUnit] Unable to find XML mapping file in classpath: /META-INF/myorm.xml

      at org.hibernate.ejb.Ejb3Configuration.addClassesToSessionFactory()
    2. Hibernate EJB
      HibernatePersistence.createEntityManagerFactory
      1. org.hibernate.ejb.Ejb3Configuration.addClassesToSessionFactory(Ejb3Configuration.java:914)
      2. org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:772)
      3. org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:183)
      4. org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:240)
      5. org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:120)
      5 frames
    3. JavaEE 7
      Persistence.createEntityManagerFactory
      1. javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:51)
      2. javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:33)
      2 frames
    4. com.iChieve.dao
      EntityManagerHelper.<clinit>
      1. com.iChieve.dao.EntityManagerHelper.<clinit>(EntityManagerHelper.java:20)
      1 frame
    5. com.iChieve.domain
      ProductCategoryUnitTest.testSave
      1. com.iChieve.domain.entity.ProductCategoryUnitTest.testSave(ProductCategoryUnitTest.java:16)
      1 frame
    6. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      4. java.lang.reflect.Method.invoke(Method.java:585)
      4 frames
    7. JUnit
      TestCase.run
      1. junit.framework.TestCase.runTest(TestCase.java:154)
      2. junit.framework.TestCase.runBare(TestCase.java:127)
      3. junit.framework.TestResult$1.protect(TestResult.java:106)
      4. junit.framework.TestResult.runProtected(TestResult.java:124)
      5. junit.framework.TestResult.run(TestResult.java:109)
      6. junit.framework.TestCase.run(TestCase.java:118)
      6 frames
    8. JUnit3 Runner
      RemoteTestRunner.main
      1. org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
      2. org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      3. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
      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