Community
Participate
Working Groups
I placed 2 or more xml-mapping files to 1 persistence unit. following exception occured: Exception in thread "main" java.lang.ExceptionInInitializerError at com.adva.fnp.pypdb.YP_DBHdlr.init(YP_DBHdlr.java:209) at com.adva.fnp.pypdb.YP_DBHdlr.getInstance(YP_DBHdlr.java:130) at com.adva.fnp.planner.common.yp.YPComponentFactory.getInstance(YPComponentFactory.java:145) at com.adva.fnp.planner.common.yp.YPControllerImpl.<init>(YPControllerImpl.java:68) at com.adva.fnp.planner.common.yp.YPControllerProvider.getNonConfigurationYPController(YPControllerProvider.java:124) at com.adva.fnp.planner.common.yp.YPControllerProvider.getServiceFor(YPControllerProvider.java:109) at com.adva.fnp.planner.common.yp.YPControllerProvider.getServiceFastFor(YPControllerProvider.java:76) at com.adva.fnp.planner.common.yp.components.WavelengthHelper.getWavelengthType(WavelengthHelper.java:160) at com.adva.fnp.planner.PlannerTestCase.<clinit>(PlannerTestCase.java:99) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:169) at com.intellij.junit4.JUnit4TestRunnerUtil.loadTestClass(JUnit4TestRunnerUtil.java:170) at com.intellij.junit4.JUnit4TestRunnerUtil.appendTestClass(JUnit4TestRunnerUtil.java:154) at com.intellij.junit4.JUnit4TestRunnerUtil.buildRequest(JUnit4TestRunnerUtil.java:74) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:61) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:192) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:64) 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:597) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:110) Caused by: Exception [EclipseLink-30005] (Eclipse Persistence Services - 2.1.1.v20100817-r8050): org.eclipse.persistence.exceptions.PersistenceUnitLoadingException Exception Description: An exception was thrown while searching for persistence archives with ClassLoader: sun.misc.Launcher$AppClassLoader@11b86e7 Internal Exception: javax.persistence.PersistenceException: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.1.1.v20100817-r8050): org.eclipse.persistence.exceptions.EntityManagerSetupException Exception Description: Predeployment of PersistenceUnit [fnp-db] failed. Internal Exception: java.lang.NullPointerException at org.eclipse.persistence.exceptions.PersistenceUnitLoadingException.exceptionSearchingForPersistenceResources(PersistenceUnitLoadingException.java:126) at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:136) at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:65) at com.adva.fnp.common.persistence.FNP_DBHelper.initEntityManagerFactory(FNP_DBHelper.java:192) at com.adva.fnp.common.persistence.FNP_DBHelper.<clinit>(FNP_DBHelper.java:58) ... 22 more Caused by: javax.persistence.PersistenceException: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.1.1.v20100817-r8050): org.eclipse.persistence.exceptions.EntityManagerSetupException Exception Description: Predeployment of PersistenceUnit [fnp-db] failed. Internal Exception: java.lang.NullPointerException at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:1005) at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.callPredeploy(JPAInitializer.java:88) at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:127) ... 25 more Caused by: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.1.1.v20100817-r8050): org.eclipse.persistence.exceptions.EntityManagerSetupException Exception Description: Predeployment of PersistenceUnit [fnp-db] failed. Internal Exception: java.lang.NullPointerException at org.eclipse.persistence.exceptions.EntityManagerSetupException.predeployFailed(EntityManagerSetupException.java:210) ... 28 more Caused by: java.lang.NullPointerException at org.eclipse.persistence.internal.jpa.metadata.xml.XMLPersistenceUnitMetadata.merge(XMLPersistenceUnitMetadata.java:156) at org.eclipse.persistence.internal.jpa.metadata.MetadataProject.setPersistenceUnitMetadata(MetadataProject.java:1663) at org.eclipse.persistence.internal.jpa.metadata.xml.XMLEntityMappings.processPersistenceUnitMetadata(XMLEntityMappings.java:602) at org.eclipse.persistence.internal.jpa.metadata.MetadataProcessor.processEntityMappings(MetadataProcessor.java:454) at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processORMetadata(PersistenceUnitProcessor.java:437) at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:959) ... 27 more The workaround was to add a <persistence-unit-defaults> tag to each mapping file. The full details are in this thread: http://www.eclipse.org/forums/index.php?t=msg&goto=651497&S=752ceb16cec25c31813cafb8d3723f4b#msg_651497
You can also get around the issue by removing one of the persistence unit metadata from one of the mapping files as they are the same (you would have seen a conflict exception otherwise had they been different). Typically a persistence unit metadata is only specified in one mapping file but it is valid to have it in multiples, e.g. if you want to seperate Eclipselink specific metadata from JPA metadata into an eclipselink-orm.xml. (an eclipselink-orm.xml also has the power to override as well and avoid conflict exceptions as mentioned previously)
Setting target and priority. See the following page for the meanings of these fields: http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines
Created attachment 195126 [details] Proposed changes
Changes have been submitted. Verified by: Tom Ware Test: Metadata processing error therefore existing XML model modified to expose the exception. With the fix in place, the exception goes away and all tests pass (full regression test suite and extended jpa test suite).
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink