I have not run the enhancer on the classes, and I'm not running the
runtime enhancer. I just found out how to pass arguments to the test
JVM earlier this afternoon so I'll test to use the runtime enhancer
as well as your proposed tests tomorrow.
This is the stacktrace:
testGetCurrentQuestionnaire
(se.databyran.prosang.questionnaire.jpa.NamedQueryTest) Time
elapsed: 0.712 sec <<< ERROR!
<openjpa-1.0.0-r420667:568756 fatal user error>
org.apache.openjpa.persistence.ArgumentException: The type "class
se.databyran.prosang.questionnaire.HealthQuestionnaire" has not been
enhanced.
at org.apache.openjpa.meta.ClassMetaData.resolveMeta
(ClassMetaData.java:1631)
at org.apache.openjpa.meta.ClassMetaData.resolve
(ClassMetaData.java:1605)
at org.apache.openjpa.meta.MetaDataRepository.processBuffer
(MetaDataRepository.java:675)
at org.apache.openjpa.meta.MetaDataRepository.resolveMeta
(MetaDataRepository.java:575)
at org.apache.openjpa.meta.MetaDataRepository.resolve
(MetaDataRepository.java:500)
at org.apache.openjpa.meta.MetaDataRepository.getMetaData
(MetaDataRepository.java:302)
at org.apache.openjpa.kernel.BrokerImpl.newObjectId
(BrokerImpl.java:1059)
at org.apache.openjpa.kernel.DelegatingBroker.newObjectId
(DelegatingBroker.java:252)
at org.apache.openjpa.persistence.EntityManagerImpl.find
(EntityManagerImpl.java:347)
at
se.databyran.prosang.questionnaire.jpa.NamedQueryTest.testGetCurrentQues
tionnaire(NamedQueryTest.java:45)
at
se.databyran.prosang.questionnaire.jpa.NamedQueryTest.testGetCurrentQues
tionnaire(NamedQueryTest.java:45)
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:589)
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 junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
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:589)
at org.apache.maven.surefire.junit.JUnitTestSet.execute
(JUnitTestSet.java:213)
at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSe
t(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:589)
at
org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess
(SurefireBooter.java:290)
at org.apache.maven.surefire.booter.SurefireBooter.main
(SurefireBooter.java:818)
6 sep 2007 kl. 18.02 skrev Patrick Linskey:
Oh, and can you post the full stack trace?
-Patrick
On 9/6/07, Patrick Linskey <[EMAIL PROTECTED]> wrote:
Hi,
A bunch of questions:
What happens if you check to see if one of your persistent classes is
instanceof org.apache.openjpa.enhance.PersistenceCapable?
Are you running the OpenJPA enhancer, or relying on the new
unenhanced support?
If the instanceof check passes, what happens if you manually iterate
the results of MyEntity.class.getInterfaces() and print out the
names?
If PersistenceCapable is in there, then it's probably a classloader
problem. What does your runtime environment look like?
-Patrick
On 9/6/07, Johan Andrén <[EMAIL PROTECTED]> wrote:
Hi
I have a strange problem with OpenJPA and I have had no success
finding a solution on the net (yet).
We have a multi module maven2 project, the subprojects
interesting in
this case beeing a data model with annotated classes - "model" and
ejb3 beans accessing the data - "ejb".
I have managed to set up unit tests in the ejb project by making
maven copy the model-jar into the target/test-classes and
referencing
it from src/test/resources/META-INF/persistence.xml. This works
well.
Since we want to catch the mapping errors etc. with the unit
tests in
the model I have been working on setting up OpenJPA for the unit
tests in that project as well. When the unit tests are run they fail
with the following exception from OpenJPA:
<openjpa-1.0.0-r420667:568756 fatal user error>
org.apache.openjpa.persistence.ArgumentException: The type "class
se.databyran.prosang.questionnaire.Questionnaire" has not been
enhanced.
I have seen another question about this and tried to set the
"openjpa.RuntimeUnenhancedClasses" property to "warn" but this does
not seem to affect the problem in any way.
The only difference I can se between the successful setup and the
failing one is that the entity classes are packed in a jar in the
ejb
project and only as directories in the classpath in the failing one.
Is this a known problem?
Versions:
Java 1.5
Maven 2.0.7
OpenJPA 1.0.0
--
Best regards
Johan Andrén [EMAIL PROTECTED]
Databyrån AB http://www.databyran.se/
Tel: +46(0) 8 50 65 64 00
Fax: +46(0) 8 50 65 64 30
Databyrån AB är certifierat enligt ISO 9001:2000
--
Patrick Linskey
202 669 5907
--
Patrick Linskey
202 669 5907
--
Med vänlig hälsning
Johan Andrén [EMAIL PROTECTED]
Databyrån AB http://www.databyran.se/
Tel: +46(0) 8 50 65 64 00
Fax: +46(0) 8 50 65 64 30
Databyrån AB är certifierat enligt ISO 9001:2000