Hi,
I have the following maven application structure:
root
- common-module
- module1 (which depends on common-module)
- module2 (which depends on common-module and module1)
I have my persistence.xml in common-module which contains a class list
of all models in module1 and module2. When I ran the unit test in
module1 I get the following exception [1].
When I remove the entities in module2 from the class list of the
persistence.xml file, module1 builts fine. This error does not occur in
the openjpa version a few weeks ago. I'm using a fresh update of the
1.1.0-SNAPSHOT version. I'm also using all default openjpa properties.
Is this a bug or is my application structure flawed? Should each module
have their own persistence.xml file?
Thanks in advance for any help.
Regards,
Adrian Co
[1]
org.unitils.core.UnitilsException: Unable to start transaction. Could
not retrieve PlatformTransactionManager from the Spring application
context. Make sure either to configure one, or use another Unitils
transaction manager. (e.g. SimpleTransactionManager, by setting the
property 'transactionManager.type' to 'simple')
at
org.unitils.database.transaction.impl.SpringTransactionManager.startTransaction(SpringTransactionManager.java:86)
at
org.unitils.database.DatabaseModule.startTransaction(DatabaseModule.java:286)
at
org.unitils.database.DatabaseModule$DatabaseTestListener.beforeTestSetUp(DatabaseModule.java:386)
at
org.unitils.core.Unitils$UnitilsTestListener.beforeTestSetUp(Unitils.java:228)
at
org.unitils.UnitilsJUnit4TestClassRunner$CustomTestClassMethodsRunner.createMethodRunner(UnitilsJUnit4TestClassRunner.java:142)
at
org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:66)
at
org.unitils.UnitilsJUnit4TestClassRunner$CustomTestClassMethodsRunner.invokeTestMethod(UnitilsJUnit4TestClassRunner.java:155)
at
org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)
at
org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
at
org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
at
org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
at
org.unitils.UnitilsJUnit4TestClassRunner.run(UnitilsJUnit4TestClassRunner.java:95)
at
org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:138)
at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:125)
at org.apache.maven.surefire.Surefire.run(Surefire.java:132)
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
org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:290)
at
org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:818)
Caused by:
org.springframework.transaction.CannotCreateTransactionException: Could
not open JPA EntityManager for transaction; nested exception is
<openjpa-1.1.0-SNAPSHOT-r420667:612846M nonfatal general error>
org.apache.openjpa.persistence.PersistenceException: null
at
org.springframework.orm.jpa.JpaTransactionManager.doBegin(JpaTransactionManager.java:374)
at
org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:350)
at
org.unitils.database.transaction.impl.SpringTransactionManager.startTransaction(SpringTransactionManager.java:82)
... 21 more
Caused by: <openjpa-1.1.0-SNAPSHOT-r420667:612846M nonfatal general
error> org.apache.openjpa.persistence.PersistenceException: null
at
org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:197)
at
org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:142)
at
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:192)
at
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:145)
at
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:56)
at
org.springframework.orm.jpa.JpaTransactionManager.createEntityManagerForTransaction(JpaTransactionManager.java:391)
at
org.springframework.orm.jpa.JpaTransactionManager.doBegin(JpaTransactionManager.java:315)
... 23 more
Caused by: java.lang.NullPointerException
at
org.apache.openjpa.meta.MetaDataRepository.loadPersistentTypes(MetaDataRepository.java:1286)
at
org.apache.openjpa.kernel.AbstractBrokerFactory.loadPersistentTypes(AbstractBrokerFactory.java:275)
at
org.apache.openjpa.kernel.AbstractBrokerFactory.initializeBroker(AbstractBrokerFactory.java:229)
at
org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:191)
... 29 more