Forwarding to the OpenJPA users list.
---------- Forwarded message ----------
From: Dain Sundstrom <[EMAIL PROTECTED]>
Date: Thu, Jul 17, 2008 at 2:07 PM
Subject: Re: Problem with openjpa enhancer - using runtime enhancement
To: [EMAIL PROTECTED]
I'm pretty sure this is the problem, and it is pretty common. The problem
is the persistence units are not processed until OpenEJB starts and that is
typically after the test class has loaded. The persistence classes
reference by the test class are loaded when the test class is loaded, which
means they are not enhanced since OpenEJB is initialized in the setUp method
(after class loading).
Kevin, the OpenEJB javaagent is our transformation hook for JEE modules.
When a JEE application is deployed we scan for persistence units and create
EntityManagerFactories. The EntityManagerFactory gets our
PersistenceUnitInfo which when OpenJPA calls addTransformer, we add the
transformer using our JavaAgent. When the application is undeployed, we
remove the transformers. We also need to support any JPA implementation
provided by the user application, and our agent lets us do that.
David, I wonder if there is a way we could add a test mode to our agent
which does eager scanning of the classpath and add transformers like OpenJPA
does.
-dain
On Jul 17, 2008, at 2:31 AM, David Blevins wrote:
I wonder if this is simply an issue that the Entity classes are loaded
> *before* OpenEJB starts and is able to hand the persistence.xml data to
> OpenJPA. If there are imports for the Entities in the TestCase then this is
> likely what's happening.
>
> You might try moving the test code around a bit to see if you can't
> separate the bootstrapping of OpenEJB (and thus OpenJPA) from the code that
> consumes the Entities. Putting the OpenEJB bits in a super class to the
> TestCase might work. Or maybe putting the test bits in an inner class.
>
> -David
>
>
> On Jul 17, 2008, at 1:40 AM, Gareth Davies wrote:
>
> Kevin,
>>
>> This is the trace output from our build with all the OpenJPA options set
>> to TRACE and RuntimeUnenhancedClasses set to unsupported, it looks like
>> it finds the classes but fails to enhance any of them. One slightly odd
>> thing about this is that it mentions that it is scanning the resources
>> "META-INF/orm.xml" for persistent types but this file doesn't exist, all
>> the persistent types are listed in the persistence.xml file, I don't
>> know if this has any significance. I have also put in the test report
>> from the initial test case that fails.
>>
>> Thanks
>>
>> Gareth
>>
>>
>> *************** Build ***************
>>
>> 575 warehouse TRACE [main] openjpa.jdbc.JDBC - <t 22413802, conn
>> 18248114> [2 ms] close
>> 643 warehouse TRACE [main] openjpa.MetaData - Scanning resource
>> "META-INF/orm.xml" for persistent types.
>> 645 warehouse TRACE [main] openjpa.MetaData -
>> parsePersistentTypeNames() found [com.par.impl.HandheldDevice,
>> com.par.impl.AbstractMessage, com.par.impl.AssetMessage,
>> com.par.impl.Product, com.par.impl.TrainingQualification,
>> com.par.impl.HandheldMessageType, com.par.impl.LiveTableColumn,
>> com.par.impl.ClientNote, com.par.impl.BusinessFormInstance,
>> com.par.impl.ObjectGroup, com.par.impl.LiveTable,
>> com.par.impl.ClientModificationRecord, com.par.impl.Location,
>> com.par.impl.Category, com.par.impl.Asset, com.par.impl.LocationType,
>> com.par.impl.Department, com.par.impl.TemperatureReading,
>> com.par.impl.AssetTransport, com.par.impl.Permission,
>> com.par.impl.AssetReservation, com.par.impl.ObjectForm,
>> com.par.impl.TemperatureDevice, com.par.impl.Domain,
>> com.par.impl.SearchFormElement, com.par.impl.Client,
>> com.par.impl.AccessCategory, com.par.impl.WarehouseRoleUser,
>> com.par.impl.UserTrainingQualification, com.par.impl.HandheldMessage,
>> com.par.impl.AssetLocation, com.par.impl.ClientAddress,
>> com.par.impl.ObjectElement, com.par.impl.SearchForm,
>> com.par.impl.DomainRoleUser, com.par.impl.Country,
>> com.par.impl.BusinessFormAnswer, com.par.impl.BusinessForm,
>> com.par.impl.ActionMessage, com.par.impl.UserDetails,
>> com.par.impl.SpecialRequirement, com.par.impl.AssetStorageRule,
>> com.par.impl.JobTitle, com.par.impl.SystemConstant, com.par.impl.Role,
>> com.par.impl.AssetSerialNumber,
>> com.par.impl.WarehouseProductPriceHistory, com.par.impl.User,
>> com.par.impl.ObjectElementType, com.par.impl.HandheldSession,
>> com.par.impl.AssetFate, com.par.impl.AccessRight,
>> com.par.impl.AssetMessageType, com.par.impl.AssetType,
>> com.par.impl.BusinessFormQuestion, com.par.impl.SystemMessageType,
>> com.par.impl.RoleUser, com.par.impl.SystemMessage].
>> 661 warehouse TRACE [main] openjpa.MetaData - Found 58 classes with
>> metadata in 23 milliseconds.
>> 17:00:11 INFO [com.par.impl.SearchFormPersistenceTestCase] - Testing
>> query...
>> 17:00:12 INFO [com.par.impl.SearchFormPersistenceTestCase] - Unable to
>> complete test case testSearchFormElement
>>
>> <openjpa-1.1.0-r422266:659716 nonfatal user error>
>> org.apache.openjpa.persistence.ArgumentException: An error occurred
>> while
>> parsing the query filter "Select searchFormElement from
>> SearchFormElement searchFormElement". Error message: The name "Search
>> FormElement" is not a recognized entity or identifier. Known entity
>> names: []
>> at
>> org.apache.openjpa.kernel.exps.AbstractExpressionBuilder.parseException(
>> AbstractExpressionBuilder.java:118)
>> at
>> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getClassMetaData(JP
>> QLExpressionBuilder.java:180)
>> at
>> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.resolveClassMetaDat
>> a(JPQLExpressionBuilder.java:150)
>> at
>> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateMetaDat
>> a(JPQLExpressionBuilder.java:225)
>> at
>> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateMetaDat
>> a(JPQLExpressionBuilder.java:195)
>> at
>> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateType(JP
>> QLExpressionBuilder.java:188)
>> at
>> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.access$600(JPQLExpr
>> essionBuilder.java:69)
>> at
>> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder$ParsedJPQL.populate
>> (JPQLExpressionBuilder.java:1754)
>> at
>> org.apache.openjpa.kernel.jpql.JPQLParser.populate(JPQLParser.java:56)
>> at
>> org.apache.openjpa.kernel.ExpressionStoreQuery.populateFromCompilation(E
>> xpressionStoreQuery.java:153)
>> at
>> org.apache.openjpa.kernel.QueryImpl.newCompilation(QueryImpl.java:657)
>> at
>> org.apache.openjpa.kernel.QueryImpl.compilationFromCache(QueryImpl.java:
>> 638)
>> at
>> org.apache.openjpa.kernel.QueryImpl.compileForCompilation(QueryImpl.java
>> :604)
>> at
>> org.apache.openjpa.kernel.QueryImpl.compileForExecutor(QueryImpl.java:66
>> 6)
>> 839 warehouse TRACE [main] openjpa.MetaData - Loading metadata for
>> "class com.par.impl.DomainRoleUser" under
>> mode "[META][QUERY]".
>> at
>> org.apache.openjpa.kernel.QueryImpl.getOperation(QueryImpl.java:1486)
>> at
>> org.apache.openjpa.kernel.DelegatingQuery.getOperation(DelegatingQuery.j
>> ava:123)
>> at
>> org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:227)
>> at
>> org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:27
>> 7)
>> at
>> com.par.impl.SearchFormPersistenceTestCase.testSearchFormElement(SearchF
>> ormPersistenceTestCase.java:6
>> 7)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
>> a:39)
>> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
>> Impl.java:25)
>> at java.lang.reflect.Method.invoke(Method.java:585)
>> at junit.framework.TestCase.runTest(TestCase.java:164)
>> at junit.framework.TestCase.runBare(TestCase.java:130)
>> 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:120)
>> at junit.framework.TestSuite.runTest(TestSuite.java:230)
>> at junit.framework.TestSuite.run(TestSuite.java:225)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
>> a:39)
>> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
>> Impl.java:25)
>> at java.lang.reflect.Method.invoke(Method.java:585)
>> at
>> org.apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.java:2
>> 13)
>> at
>> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSe
>> t(AbstractDirectoryTestSuite.java:138)
>> at
>> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(Abstr
>> actDirectoryTestSuite.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.jav
>> a:39)
>> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
>> Impl.java:25)
>> at java.lang.reflect.Method.invoke(Method.java:585)
>> at
>> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(Suref
>> ireBooter.java:308)
>> at
>> org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java
>> :879)
>> Tests run: 2, Failures: 1, Errors: 1, Skipped: 0, Time elapsed: 1.427
>> sec <<< FAILURE!
>> Running com.par.impl.UserPersistenceTestCase
>> 902 warehouse TRACE [main] openjpa.MetaData - Parsing class
>> "com.par.impl.DomainRoleUser".
>> 902 warehouse TRACE [main] openjpa.MetaData - Parsing package
>> "com.par.impl.DomainRoleUser".
>> 1031 warehouse TRACE [main] openjpa.MetaData - Generating default
>> metadata for type "com.par.impl.DomainRoleU
>> ser".
>> 1031 warehouse TRACE [main] openjpa.MetaData - Using reflection for
>> metadata generation.
>> 1034 warehouse TRACE [main] openjpa.MetaData - Parsing query
>> "guestUser".
>> 1034 warehouse TRACE [main] openjpa.MetaData - Parsing query
>> "domainRoleUserList".
>> 1040 warehouse TRACE [main] openjpa.MetaData - Loading metadata for
>> "class com.par.impl.RoleUser" under mode
>> "[META][QUERY]".
>> 1040 warehouse TRACE [main] openjpa.MetaData - Parsing class
>> "com.par.impl.RoleUser".
>> 1043 warehouse TRACE [main] openjpa.MetaData - Generating default
>> metadata for type "com.par.impl.RoleUser".
>> 1043 warehouse TRACE [main] openjpa.MetaData - Using reflection for
>> metadata generation.
>> 1060 warehouse TRACE [main] openjpa.MetaData - Parsing query
>> "rolesForUser".
>> 1060 warehouse TRACE [main] openjpa.MetaData - Parsing query
>> "fullLoadRoleUser".
>> 1060 warehouse TRACE [main] openjpa.MetaData - Parsing query
>> "RoleUser.BySearchString".
>> 1060 warehouse TRACE [main] openjpa.MetaData - Parsing native query
>> "hasRoleUserGotPermission".
>> 1060 warehouse TRACE [main] openjpa.MetaData - Parsing native query
>> "hasRoleUserGotPermissionWithValue".
>> 1060 warehouse TRACE [main] openjpa.MetaData - Parsing native query
>> "getPermissionValueForRoleUser".
>> 1066 warehouse TRACE [main] openjpa.MetaData - Generating default
>> metadata for type "com.par.impl.UserDetails
>> ".
>> 1066 warehouse TRACE [main] openjpa.MetaData - Using reflection for
>> metadata generation.
>> 1073 warehouse TRACE [main] openjpa.MetaData - Parsing result set
>> mapping "ResultMapping".
>> 1075 warehouse TRACE [main] openjpa.MetaData - Loading metadata for
>> "class com.par.impl.User" under mode "[ME
>> TA][QUERY]".
>> 1076 warehouse TRACE [main] openjpa.MetaData - Parsing class
>> "com.par.impl.User".
>> 1078 warehouse TRACE [main] openjpa.MetaData - Generating default
>> metadata for type "com.par.impl.User".
>> 1078 warehouse TRACE [main] openjpa.MetaData - Using reflection for
>> metadata generation.
>> 1091 warehouse TRACE [main] openjpa.MetaData - Set
>> persistence-capable superclass of "com.par.impl.User" to "
>> null".
>> 1091 warehouse TRACE [main] openjpa.MetaData - Resolving metadata for
>> "[EMAIL PROTECTED]".
>> 17:00:12 ERROR [com.par.impl.UserPersistenceTestCase] - Unable to
>> complete test case
>> <openjpa-1.1.0-r422266:659716 fatal user error>
>> org.apache.openjpa.persistence.ArgumentException: The type "class com.
>> par.impl.User" has not been enhanced.
>> at
>> org.apache.openjpa.meta.ClassMetaData.resolveMeta(ClassMetaData.java:164
>> 6)
>> at
>> org.apache.openjpa.meta.ClassMetaData.resolve(ClassMetaData.java:1620)
>> at
>> org.apache.openjpa.meta.MetaDataRepository.processBuffer(MetaDataReposit
>> ory.java:717)
>> at
>> org.apache.openjpa.meta.MetaDataRepository.resolveMeta(MetaDataRepositor
>> y.java:616)
>> at
>> org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.ja
>> va:541)
>> at
>> org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepositor
>> y.java:308)
>> at
>> org.apache.openjpa.meta.MetaDataRepository.resolveMeta(MetaDataRepositor
>> y.java:581)
>> at
>> org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.ja
>> va:541)
>> at
>> org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepositor
>> y.java:308)
>> 1109 warehouse TRACE [main] openjpa.Query - Executing query: [select
>> count(*) as Result from RoleUser left join Role on Ro
>> leUser.RoleId = Role.RoleId left join RoleAccess on Role.RoleId =
>> RoleAccess.RoleId where UserId = ?1 and RoleAccess.AccessNa
>> me = ?2 and RoleAccess.AccessValue LIKE 'YES'] with parameters: {0=1,
>> 1=ADD_CLIENT}
>> at
>> org.apache.openjpa.meta.MetaDataRepository.resolveMeta(MetaDataRepositor
>> y.java:581)
>> at
>> org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.ja
>> va:541)
>> at
>> org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepositor
>> y.java:308)
>> at
>> org.apache.openjpa.kernel.AttachManager.attach(AttachManager.java:237)
>> at
>> org.apache.openjpa.kernel.AttachManager.attach(AttachManager.java:101)
>> at
>> org.apache.openjpa.kernel.BrokerImpl.attach(BrokerImpl.java:3206)
>> at
>> org.apache.openjpa.kernel.DelegatingBroker.attach(DelegatingBroker.java:
>> 1158)
>> at
>> org.apache.openjpa.persistence.EntityManagerImpl.merge(EntityManagerImpl
>> .java:769)
>> at
>> com.par.impl.UserPersistenceTestCase.testUserManager(UserPersistenceTest
>> Case.java:30)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
>> a:39)
>> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
>> Impl.java:25)
>> at java.lang.reflect.Method.invoke(Method.java:585)
>> at junit.framework.TestCase.runTest(TestCase.java:164)
>> at junit.framework.TestCase.runBare(TestCase.java:130)
>> 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:120)
>> at junit.framework.TestSuite.runTest(TestSuite.java:230)
>> at junit.framework.TestSuite.run(TestSuite.java:225)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
>> a:39)
>> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
>> Impl.java:25)
>> at java.lang.reflect.Method.invoke(Method.java:585)
>> at
>> org.apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.java:2
>> 13)
>> at
>> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSe
>> t(AbstractDirectoryTestSuite.java:138)
>> at
>> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(Abstr
>> actDirectoryTestSuite.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.jav
>> a:39)
>> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
>> Impl.java:25)
>> at java.lang.reflect.Method.invoke(Method.java:585)
>> at
>> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(Suref
>> ireBooter.java:308)
>> at
>> org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java
>> :879)
>>
>>
>>
>> *************** Test ***************
>>
>> ------------------------------------------------------------------------
>> -------
>> Test set: com.par.impl.SearchFormPersistenceTestCase
>> ------------------------------------------------------------------------
>> -------
>> Tests run: 2, Failures: 1, Errors: 1, Skipped: 0, Time elapsed: 1.477
>> sec <<< FAILURE!
>> testSearchForm(com.par.impl.SearchFormPersistenceTestCase) Time
>> elapsed: 1.35 sec <<< ERROR!
>> <openjpa-1.1.0-r422266:659716 nonfatal user error>
>> org.apache.openjpa.persistence.ArgumentException: This configuration
>> disallows runtime optimization, but the following listed types were not
>> enhanced at build time or at class load time with a javaagent: "[class
>> com.par.impl.HandheldDevice, class com.par.impl.AbstractMessage, class
>> com.par.impl.AssetMessage, class com.par.impl.Product, class
>> com.par.impl.TrainingQualification, class
>> com.par.impl.HandheldMessageType, class com.par.impl.LiveTableColumn,
>> class com.par.impl.ClientNote, class com.par.impl.BusinessFormInstance,
>> class com.par.impl.ObjectGroup, class com.par.impl.LiveTable, class
>> com.par.impl.ClientModificationRecord, class com.par.impl.Location,
>> class com.par.impl.Category, class com.par.impl.Asset, class
>> com.par.impl.LocationType, class com.par.impl.Department, class
>> com.par.impl.TemperatureReading, class com.par.impl.AssetTransport,
>> class com.par.impl.Permission, class com.par.impl.AssetReservation,
>> class com.par.impl.ObjectForm, class com.par.impl.TemperatureDevice,
>> class com.par.impl.Domain, class com.par.impl.SearchFormElement, class
>> com.par.impl.Client, class com.par.impl.AccessCategory, class
>> com.par.impl.WarehouseRoleUser, class
>> com.par.impl.UserTrainingQualification, class
>> com.par.impl.HandheldMessage, class com.par.impl.AssetLocation, class
>> com.par.impl.ClientAddress, class com.par.impl.ObjectElement, class
>> com.par.impl.SearchForm, class com.par.impl.DomainRoleUser, class
>> com.par.impl.Country, class com.par.impl.BusinessFormAnswer, class
>> com.par.impl.BusinessForm, class com.par.impl.ActionMessage, class
>> com.par.impl.UserDetails, class com.par.impl.SpecialRequirement, class
>> com.par.impl.AssetStorageRule, class com.par.impl.JobTitle, class
>> com.par.impl.SystemConstant, class com.par.impl.Role, class
>> com.par.impl.AssetSerialNumber, class
>> com.par.impl.WarehouseProductPriceHistory, class com.par.impl.User,
>> class com.par.impl.ObjectElementType, class
>> com.par.impl.HandheldSession, class com.par.impl.AssetFate, class
>> com.par.impl.AccessRight, class com.par.impl.AssetMessageType, class
>> com.par.impl.AssetType, class com.par.impl.BusinessFormQuestion, class
>> com.par.impl.SystemMessageType, class com.par.impl.RoleUser, class
>> com.par.impl.SystemMessage]".
>> at
>> org.apache.openjpa.enhance.ManagedClassSubclasser.prepareUnenhancedClass
>> es(ManagedClassSubclasser.java:102)
>> at
>> org.apache.openjpa.kernel.AbstractBrokerFactory.loadPersistentTypes(Abst
>> ractBrokerFactory.java:310)
>> at
>> org.apache.openjpa.kernel.AbstractBrokerFactory.initializeBroker(Abstrac
>> tBrokerFactory.java:228)
>> at
>> org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBroker
>> Factory.java:190)
>> at
>> org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBr
>> okerFactory.java:142)
>> at
>> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityMana
>> ger(EntityManagerFactoryImpl.java:192)
>> at
>> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityMana
>> ger(EntityManagerFactoryImpl.java:145)
>> at
>> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityMana
>> ger(EntityManagerFactoryImpl.java:56)
>> at
>> com.par.impl.SearchFormPersistenceTestCase.testSearchForm(SearchFormPers
>> istenceTestCase.java:17)
>> at
>> com.par.impl.SearchFormPersistenceTestCase.testSearchForm(SearchFormPers
>> istenceTestCase.java:17)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
>> a:39)
>> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
>> Impl.java:25)
>> at java.lang.reflect.Method.invoke(Method.java:585)
>> at junit.framework.TestCase.runTest(TestCase.java:164)
>> at junit.framework.TestCase.runBare(TestCase.java:130)
>> 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:120)
>> at junit.framework.TestSuite.runTest(TestSuite.java:230)
>> at junit.framework.TestSuite.run(TestSuite.java:225)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
>> a:39)
>> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
>> Impl.java:25)
>> at java.lang.reflect.Method.invoke(Method.java:585)
>> at
>> org.apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.java:2
>> 13)
>> at
>> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSe
>> t(AbstractDirectoryTestSuite.java:138)
>> at
>> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(Abstr
>> actDirectoryTestSuite.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.jav
>> a:39)
>> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
>> Impl.java:25)
>> at java.lang.reflect.Method.invoke(Method.java:585)
>> at
>> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(Suref
>> ireBooter.java:308)
>> at
>> org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java
>> :879)
>>
>>
>>
>> -----Original Message-----
>> From: Kevin Sutter [mailto:[EMAIL PROTECTED]
>> Sent: 16 July 2008 18:30
>> To: [email protected]; [EMAIL PROTECTED]
>> Subject: Re: Problem with openjpa enhancer - using runtime enhancement
>>
>> Gareth,
>> If you are still falling into the non-enhanced class file path, then
>> there's still something wrong with the javaagent processing. I'm not
>> following the reference that Nathan provided [1]. I'm not clear on what
>> it's trying to tell me. Is the javaagent provided by OpenEJB supposed
>> to automatically include the one provided by OpenJPA? The jar file that
>> was referenced previously does not seem to have any OpenJPA code in it,
>> so I'm confused.
>> Or, does OpenEJB require both agents? Maybe this needs to be discussed
>> on the OpenEJB forum? I'll try cross-posting to see if we get any
>> input.
>>
>> In the mean time, you could turn on the OpenJPA trace to see if we are
>> even getting any of the classes to be enhanced. My guess is that this
>> trace won't show the classes because they are not getting to our agent
>> for transforming. But, it's worth a shot. Maybe there's some problem
>> during the transformation that gets eaten by the classloading mechanism.
>>
>> Another possibility is that the class that gets transformed during the
>> agent processing is not the same class that is loaded later by the
>> runtime. A classloader issue with OpenEJB? A long shot, but I'm just
>> trying to generate some thoughts by any of the readers.
>>
>> Can you provide more details on the specific messages you are getting
>> after turning off the fallback enhancement process? Does it show all of
>> your entities as not being processed? Or, is it a subset? Are you
>> listing your classes in your persistence.xml or are you relying on
>> classloader detection?
>>
>> I have not seen a problem with the agent enhancement process. It's
>> basically the exact same code as our static enhancement, except for how
>> it's kicked off. Any additional details or testcases on how to
>> reproduce it would help with the diagnosis.
>>
>> Thanks,
>> Kevin
>>
>> [1] http://openejb.apache.org/tomcat.html#Tomcat-Limitations
>>
>> On Wed, Jul 16, 2008 at 11:04 AM, Gareth Davies
>> <[EMAIL PROTECTED]>
>> wrote:
>>
>> Kevin,
>>>
>>> Thanks for your suggestion, I have tried changing it to use the
>>> OpenJPA jar file as you suggested, and added the relevant geronimo-jta
>>>
>>
>> jar file to the class path, but unfortunately it still has the same
>>> problem with unenhanced classes.
>>>
>>> Thanks
>>>
>>> Gareth
>>>
>>> -----Original Message-----
>>> From: Kevin Sutter [mailto:[EMAIL PROTECTED]
>>> Sent: 16 July 2008 16:30
>>> To: [email protected]
>>> Subject: Re: Problem with openjpa enhancer - using runtime enhancement
>>>
>>> Gareth,
>>> I'm not familar with the openejb-javaagent-3.0.jar. Does that contain
>>>
>>
>> the OpenJPA code? From what I can tell, it does not. (I just now
>>> noticed that you had said you were using this and it didn't register
>>> when I first read your note.)
>>>
>>> Try replacing this stanza with the openjpa-1.1.0.jar (since you stated
>>>
>>
>> that you are using 1.1.0).
>>>
>>> Kevin
>>>
>>> On Wed, Jul 16, 2008 at 10:08 AM, Gareth Davies
>>> <[EMAIL PROTECTED]>
>>> wrote:
>>>
>>> Kevin,
>>>>
>>>> Thanks for your reply, I changed the RuntimeUnhenhancedClasses to
>>>> unsupported as you suggested and I did get the error message stating
>>>>
>>>
>> that my a number of my classes were not enhanced. So does this mean
>>>>
>>>
>> that the javaagent is not working correctly? I am specifying it in
>>>> my
>>>>
>>>
>>> maven pom.xml when the maven-surefire plugin is called with the
>>>> following:
>>>>
>>>>
>>>> <plugin>
>>>> <groupId>org.apache.maven.plugins</groupId>
>>>> <artifactId>maven-surefire-plugin</artifactId>
>>>> <configuration>
>>>> <forkMode>once</forkMode>
>>>>
>>>> <argLine>-javaagent:${project.build.directory}/openejb-javaagent-3.0
>>>> .j
>>>> ar
>>>> </argLine>
>>>> <systemProperties>
>>>> <property>
>>>>
>>>> <name>net.sourceforge.cobertura.datafile</name>
>>>>
>>>> <value>target/cobertura/cobertura.ser</value>
>>>> </property>
>>>> <property>
>>>> <name>pom.version</name>
>>>> <value>${pom.version}</value>
>>>> </property>
>>>> <property>
>>>> <name>appserver</name>
>>>> <value>${appserver}</value>
>>>> </property>
>>>> </systemProperties>
>>>> </configuration>
>>>> </plugin>
>>>>
>>>>
>>>>
>>>> I have also got the openejb jar file being copied to the required
>>>> location earlier on in the build.
>>>>
>>>> I will have a look at producing a testcase to demonstrate this
>>>>
>>> today.
>>
>>>
>>>> Thanks
>>>>
>>>> Gareth
>>>>
>>>>
>>>> -----Original Message-----
>>>> From: Kevin Sutter [mailto:[EMAIL PROTECTED]
>>>> Sent: 16 July 2008 15:46
>>>> To: [email protected]
>>>> Subject: Re: Problem with openjpa enhancer - using runtime
>>>> enhancement
>>>>
>>>> Gareth,
>>>> Recently, I found an obscure problem with the IBM JDK when using
>>>> the javaagent enhancement, but I don't see how this would apply to
>>>> this situation. You end up with a nasty exception from the Java
>>>> runtime, and I would think you would have mentioned that...
>>>>
>>>> Other than than, I am not aware of any differences between the two
>>>> forms of enhancement.
>>>>
>>>> One idea is to ensure that the -javaagent is really taking effect.
>>>> Besides these two enhancement mechanisms, there is a third fallback
>>>> mechanism. This fallback mechanism is not quite "ready for
>>>>
>>> production"
>>
>>> and I would recommend turning it off. We do that for WebSphere.
>>>>
>>>> openjpa.RuntimeUnenhancedClasses=unsupported (along with your
>>>> -javaagent
>>>> setting)
>>>>
>>>> This can be specified as a property in their persistence.xml or as a
>>>>
>>>
>> java command line parameter (-Dxxx=yyy).
>>>>
>>>> If you are accidentally falling into this third style of
>>>> enhancement, then you will get an error about a particular entity
>>>> not being enhanced and your processing will quit. At least this
>>>> will show whether you are using your -javaagent like you expected.
>>>>
>>>> Do you have a simple testcase that you could share to demonstrate
>>>> the problem?
>>>>
>>>> Thanks,
>>>> Kevin
>>>>
>>>>
>>>> On Wed, Jul 16, 2008 at 4:34 AM, Gareth Davies
>>>> <[EMAIL PROTECTED]>
>>>> wrote:
>>>>
>>>> Hi
>>>>>
>>>>> Openjpa 1.1.0
>>>>>
>>>>> I am having a problem with runtime enhancement on my persistent
>>>>> entities. Runtime enhancement completes during my test phase
>>>>> using the openejb 3.0 javaagent, but when the unit tests run I
>>>>> have problems
>>>>>
>>>>
>>>> relating to merges using the entityManager. The id field does not
>>>>>
>>>>
>> seem to be generated correctly it seems to be giving it a 0 value
>>>>> rather than the next available id and it doesn't actually seem to
>>>>> be
>>>>>
>>>>
>>> inserting into the database. I have tried the same build process
>>>>> using build time enhancement and all the tests pass (I would use
>>>>> build
>>>>>
>>>>
>>>> time enhancement but having tried it during the build with the
>>>>> openjpa-maven-plugin, which seems to only support openjpa 0.9.6,
>>>>> my command line is too long ~16100 characters and Windows limit is
>>>>>
>>>>
>> 8192, I had to resort to a batch file).
>>>>>
>>>>> Has anyone else had any issues with this, or are there difference
>>>>> between runtime and build time enhancement that are causing these
>>>>> failures.
>>>>>
>>>>> Also if anyone has any ideas about getting the build time
>>>>> enhancement to run as part of a maven build without using the
>>>>> openjpa-maven-plugin
>>>>>
>>>>
>>>> that would be great.
>>>>>
>>>>> Thanks
>>>>>
>>>>> Gareth Davies
>>>>>
>>>>>
>>>>
>>>
>>
>