Problem with openjpa enhancer - using runtime enhancement

15 messages Options
Embed this post
Permalink
Gareth Davies

Problem with openjpa enhancer - using runtime enhancement

Reply Threaded More More options
Print post
Permalink
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
Kevin Sutter

Re: Problem with openjpa enhancer - using runtime enhancement

Reply Threaded More More options
Print post
Permalink
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 <[hidden email]>
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
>
Gareth Davies

RE: Problem with openjpa enhancer - using runtime enhancement

Reply Threaded More More options
Print post
Permalink
In reply to this post by Gareth Davies
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.jar
</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:[hidden email]]
Sent: 16 July 2008 15:46
To: [hidden email]
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
<[hidden email]>
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
>
Kevin Sutter

Re: Problem with openjpa enhancer - using runtime enhancement

Reply Threaded More More options
Print post
Permalink
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 <[hidden email]>
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.jar
> </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:[hidden email]]
> Sent: 16 July 2008 15:46
> To: [hidden email]
> 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
> <[hidden email]>
> 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
> >
>
Beyer,Nathan

RE: Problem with openjpa enhancer - using runtime enhancement

Reply Threaded More More options
Print post
Permalink
BTW - The OpenEJB agent is supposedly only there for OpenJPA's enhancement [1]. The code maybe slightly different, but it's necessary to use JPA+EJB with OpenEJB as the provider.

[1] http://openejb.apache.org/tomcat.html#Tomcat-Limitations

-----Original Message-----
From: Kevin Sutter [mailto:[hidden email]]
Sent: Wednesday, July 16, 2008 10:25 AM
To: [hidden email]
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 <[hidden email]>
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.jar
> </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:[hidden email]]
> Sent: 16 July 2008 15:46
> To: [hidden email]
> 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
> <[hidden email]>
> 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
> >
>

----------------------------------------------------------------------
CONFIDENTIALITY NOTICE This message and any included attachments are from Cerner Corporation and are intended only for the addressee. The information contained in this message is confidential and may constitute inside or non-public information under international, federal, or state securities laws. Unauthorized forwarding, printing, copying, distribution, or use of such information is strictly prohibited and may be unlawful. If you are not the addressee, please promptly delete this message and notify the sender of the delivery error by e-mail or you may call Cerner's corporate offices in Kansas City, Missouri, U.S.A at (+1) (816)221-1024.
Gareth Davies

RE: Problem with openjpa enhancer - using runtime enhancement

Reply Threaded More More options
Print post
Permalink
In reply to this post by Gareth Davies
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:[hidden email]]
Sent: 16 July 2008 16:30
To: [hidden email]
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
<[hidden email]>
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:[hidden email]]
> Sent: 16 July 2008 15:46
> To: [hidden email]
> 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
> <[hidden email]>
> 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
> >
>
Kevin Sutter

Re: Problem with openjpa enhancer - using runtime enhancement

Reply Threaded More More options
Print post
Permalink
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 <[hidden email]>
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:[hidden email]]
> Sent: 16 July 2008 16:30
> To: [hidden email]
> 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
> <[hidden email]>
> 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:[hidden email]]
> > Sent: 16 July 2008 15:46
> > To: [hidden email]
> > 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
> > <[hidden email]>
> > 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
> > >
> >
>
Beyer,Nathan

RE: Problem with openjpa enhancer - using runtime enhancement

Reply Threaded More More options
Print post
Permalink
OpenEJB provides their own JavaAgent to get the Instrumentation instances, but they take a different approach to transforming the classes. In OpenJPA, as I understand it, the enhancement is done aggressively and up front when the agent loads - at least it acts like that since the agent MUST find a persistence.xml or list of entity classes. In OpenEJB, the enhancement is more passively and just happens as it's needed.

I've only been digging into this for a few weeks, so my understanding isn't complete.

-Nathan

-----Original Message-----
From: Kevin Sutter [mailto:[hidden email]]
Sent: Wednesday, July 16, 2008 11:45 AM
To: [hidden email]; [hidden email]
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 <[hidden email]>
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:[hidden email]]
> Sent: 16 July 2008 16:30
> To: [hidden email]
> 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
> <[hidden email]>
> 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:[hidden email]]
> > Sent: 16 July 2008 15:46
> > To: [hidden email]
> > 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
> > <[hidden email]>
> > 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
> > >
> >
>

----------------------------------------------------------------------
CONFIDENTIALITY NOTICE This message and any included attachments are from Cerner Corporation and are intended only for the addressee. The information contained in this message is confidential and may constitute inside or non-public information under international, federal, or state securities laws. Unauthorized forwarding, printing, copying, distribution, or use of such information is strictly prohibited and may be unlawful. If you are not the addressee, please promptly delete this message and notify the sender of the delivery error by e-mail or you may call Cerner's corporate offices in Kansas City, Missouri, U.S.A at (+1) (816)221-1024.
Gareth Davies

RE: Problem with openjpa enhancer - using runtime enhancement

Reply Threaded More More options
Print post
Permalink
In reply to this post by Gareth Davies
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
"com.par.impl.User@32316171".
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:[hidden email]]
Sent: 16 July 2008 18:30
To: [hidden email]; [hidden email]
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
<[hidden email]>
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:[hidden email]]
> Sent: 16 July 2008 16:30
> To: [hidden email]
> 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
> <[hidden email]>
> 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:[hidden email]]
> > Sent: 16 July 2008 15:46
> > To: [hidden email]
> > 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
> > <[hidden email]>
> > 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
> > >
> >
>
David Blevins

Re: Problem with openjpa enhancer - using runtime enhancement

Reply Threaded More More options
Print post
Permalink
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
> "com.par.impl.User@32316171".
> 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:[hidden email]]
> Sent: 16 July 2008 18:30
> To: [hidden email]; [hidden email]
> 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
> <[hidden email]>
> 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:[hidden email]]
>> Sent: 16 July 2008 16:30
>> To: [hidden email]
>> 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
>> <[hidden email]>
>> 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:[hidden email]]
>>> Sent: 16 July 2008 15:46
>>> To: [hidden email]
>>> 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
>>> <[hidden email]>
>>> 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
>>>>
>>>
>>
>

Kevin Sutter

Re: Problem with openjpa enhancer - using runtime enhancement

Reply Threaded More More options
Print post
Permalink
In reply to this post by Gareth Davies
Gareth,
It still seems like the -javaagent is not taking effect.  What version of
the surefire plugin are you using?  If it's 2.3, you might be hitting the
problem in this Issue:  http://jira.codehaus.org/browse/SUREFIRE-297.  The
initial description sounds exactly like your situation.

Can you run your maven script with debug (-X) to see exactly what jvm
arguments are being passed to the process?

Sorry that I'm still grabbing at straws, but I have not been able to
reproduce the situation yet.  I run with a javaagent for most of my testing
and haven't experienced this problem.

Thanks for your patience,
Kevin


On Thu, Jul 17, 2008 at 3:40 AM, Gareth Davies <[hidden email]>
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
> "com.par.impl.User@32316171".
> 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:[hidden email]]
> Sent: 16 July 2008 18:30
> To: [hidden email]; [hidden email]
> 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
> <[hidden email]>
> 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:[hidden email]]
> > Sent: 16 July 2008 16:30
> > To: [hidden email]
> > 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
> > <[hidden email]>
> > 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:[hidden email]]
> > > Sent: 16 July 2008 15:46
> > > To: [hidden email]
> > > 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
> > > <[hidden email]>
> > > 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
> > > >
> > >
> >
>
Gareth Davies

RE: Problem with openjpa enhancer - using runtime enhancement

Reply Threaded More More options
Print post
Permalink
In reply to this post by Gareth Davies
Kevin,

We were using the surefire plugin version 2.3.1, but I have now changed
it to the most recent version, 2.4.3.

I agree about the javaagent, I have run the project with debug enabled
and this is the output:

Forking command line: cmd.exe /X /C ""c:\Program
Files\Java\jdk1.5.0_15\jre\bin\java" -Xmx256m -jar
C:\Users\GDAVIE~1.MSO\App
Data\Local\Temp\surefirebooter22470.jar
C:\Users\GDAVIE~1.MSO\AppData\Local\Temp\surefire22468tmp
C:\Users\GDAVIE~1.MSO\AppDa
ta\Local\Temp\surefire22469tmp"

There is no mention of the javaagent anywhere in the output.

So I had a look around in the pom, I realised that the argument -Xmx256m
being passed into this command was coming from the parent pom, so I
added the relevant arguments to that pom, i.e.
-javaagent:${project.build.directory}/openjpa-1.1.0.jar.  This led to
the following command line:


Forking command line: cmd.exe /X /C ""c:\Program
Files\Java\jdk1.5.0_15\jre\bin\java"
-javaagent:C:\Users\gdavies.MSOFT\works
pace\e-ices-wasce\application-shared\target/openjpa-1.1.0.jar -jar
C:\Users\GDAVIE~1.MSO\AppData\Local\Temp\surefirebooter353
46.jar C:\Users\GDAVIE~1.MSO\AppData\Local\Temp\surefire35344tmp
C:\Users\GDAVIE~1.MSO\AppData\Local\Temp\surefire35345tmp"
java.lang.reflect.InvocationTargetException


This gave me the error message that it could not find
org/apache/commons/collections/set/MapBackedSet:


java.lang.reflect.InvocationTargetException
        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
sun.instrument.InstrumentationImpl.loadClassAndCallPremain(Instrumentati
onImpl.java:141)
Caused by: java.lang.RuntimeException: There were errors initializing
your configuration: java.lang.NoClassDefFoundError: org
/apache/commons/collections/set/MapBackedSet
FATAL ERROR in native method: processing of -javaagent failed
        at
org.apache.openjpa.lib.util.concurrent.NullSafeConcurrentHashMap.<init>(
NullSafeConcurrentHashMap.java:52)
        at
org.apache.openjpa.util.ProxyManagerImpl.<init>(ProxyManagerImpl.java:97
)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
        at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorA
ccessorImpl.java:39)
        at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingCons
tructorAccessorImpl.java:27)
        at
java.lang.reflect.Constructor.newInstance(Constructor.java:494)
        at java.lang.Class.newInstance0(Class.java:350)
        at java.lang.Class.newInstance(Class.java:303)
        at
org.apache.openjpa.lib.util.J2DoPrivHelper$11.run(J2DoPrivHelper.java:34
3)
        at java.security.AccessController.doPrivileged(Native Method)
        at
org.apache.openjpa.lib.conf.Configurations.newInstance(Configurations.ja
va:221)
        at
org.apache.openjpa.lib.conf.ObjectValue.newInstance(ObjectValue.java:109
)
        at
org.apache.openjpa.lib.conf.PluginValue.instantiate(PluginValue.java:102
)
        at
org.apache.openjpa.lib.conf.ObjectValue.instantiate(ObjectValue.java:83)
        at
org.apache.openjpa.conf.OpenJPAConfigurationImpl.getProxyManagerInstance
(OpenJPAConfigurationImpl.java:795)
        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.openjpa.lib.conf.ConfigurationImpl.instantiateAll(Configurati
onImpl.java:288)
        at
org.apache.openjpa.conf.OpenJPAConfigurationImpl.instantiateAll(OpenJPAC
onfigurationImpl.java:1409)
        at
org.apache.openjpa.enhance.PCEnhancerAgent.registerClassLoadEnhancer(PCE
nhancerAgent.java:113)
        at
org.apache.openjpa.enhance.PCEnhancerAgent.premain(PCEnhancerAgent.java:
80)
        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
sun.instrument.InstrumentationImpl.loadClassAndCallPremain(Instrumentati
onImpl.java:141)


So I included the the apache commons collections jar file in the
classpath as so:


Forking command line: cmd.exe /X /C ""c:\Program
Files\Java\jdk1.5.0_15\jre\bin\java" -cp
C:\Users\gdavies.MSOFT\workspace\e-
ices-wasce\application-shared\target/commons-collections-3.2.jar
-javaagent:C:\Users\gdavies.MSOFT\workspace\e-ices-wasce\app
lication-shared\target/openjpa-1.1.0.jar -jar
C:\Users\GDAVIE~1.MSO\AppData\Local\Temp\surefirebooter6917.jar
C:\Users\GDAVIE
~1.MSO\AppData\Local\Temp\surefire6915tmp
C:\Users\GDAVIE~1.MSO\AppData\Local\Temp\surefire6916tmp"


But it still gives me the same error...


java.lang.reflect.InvocationTargetException
        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
sun.instrument.InstrumentationImpl.loadClassAndCallPremain(Instrumentati
onImpl.java:141)
Caused by: java.lang.RuntimeException: There were errors initializing
your configuration: java.lang.NoClassDefFoundError: org
/apache/commons/collections/set/MapBackedSet
FATAL ERROR in native method: processing of -javaagent failed
        at
org.apache.openjpa.lib.util.concurrent.NullSafeConcurrentHashMap.<init>(
NullSafeConcurrentHashMap.java:52)
        at
org.apache.openjpa.util.ProxyManagerImpl.<init>(ProxyManagerImpl.java:97
)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
        at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorA
ccessorImpl.java:39)
        at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingCons
tructorAccessorImpl.java:27)
        at
java.lang.reflect.Constructor.newInstance(Constructor.java:494)
        at java.lang.Class.newInstance0(Class.java:350)
        at java.lang.Class.newInstance(Class.java:303)
        at
org.apache.openjpa.lib.util.J2DoPrivHelper$11.run(J2DoPrivHelper.java:34
3)
        at java.security.AccessController.doPrivileged(Native Method)
        at
org.apache.openjpa.lib.conf.Configurations.newInstance(Configurations.ja
va:221)
        at
org.apache.openjpa.lib.conf.ObjectValue.newInstance(ObjectValue.java:109
)
        at
org.apache.openjpa.lib.conf.PluginValue.instantiate(PluginValue.java:102
)
        at
org.apache.openjpa.lib.conf.ObjectValue.instantiate(ObjectValue.java:83)
        at
org.apache.openjpa.conf.OpenJPAConfigurationImpl.getProxyManagerInstance
(OpenJPAConfigurationImpl.java:795)
        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.openjpa.lib.conf.ConfigurationImpl.instantiateAll(Configurati
onImpl.java:288)
        at
org.apache.openjpa.conf.OpenJPAConfigurationImpl.instantiateAll(OpenJPAC
onfigurationImpl.java:1409)
        at
org.apache.openjpa.enhance.PCEnhancerAgent.registerClassLoadEnhancer(PCE
nhancerAgent.java:113)
        at
org.apache.openjpa.enhance.PCEnhancerAgent.premain(PCEnhancerAgent.java:
80)
        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
sun.instrument.InstrumentationImpl.loadClassAndCallPremain(Instrumentati
onImpl.java:141)


I'm not sure why its not picking up the jar file and finding the class
specified...

So I thought I would try it with the open ejb javaagent as below:


Forking command line: cmd.exe /X /C ""c:\Program
Files\Java\jdk1.5.0_15\jre\bin\java"
-javaagent:C:\Users\gdavies.MSOFT\works
pace\e-ices-wasce\application-shared\target/openejb-javaagent-3.0.jar
-jar C:\Users\GDAVIE~1.MSO\AppData\Local\Temp\surefireb
ooter7501.jar C:\Users\GDAVIE~1.MSO\AppData\Local\Temp\surefire7499tmp
C:\Users\GDAVIE~1.MSO\AppData\Local\Temp\surefire7500t
mp"


This time it processes the javaagent no problems but still does not
enhance the classes, the initial error in the first test to fail is
similar to last time without the javaagent:


Tests run: 2, Failures: 1, Errors: 1, Skipped: 0, Time elapsed: 4.769
sec <<< FAILURE!
testSearchForm(com.par.impl.SearchFormPersistenceTestCase)  Time
elapsed: 1.653 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.falcon.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)

testSearchFormElement(com.par.impl.SearchFormPersistenceTestCase)  Time
elapsed: 3.087 sec  <<< FAILURE!
junit.framework.AssertionFailedError: 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
"SearchFormElement" is not a recognized entity or identifier. Known
entity names: []
        at junit.framework.Assert.fail(Assert.java:47)
        at
com.par.impl.SearchFormPersistenceTestCase.testSearchFormElement(SearchF
ormPersistenceTestCase.java:90)



Thanks

Gareth

-----Original Message-----
From: Kevin Sutter [mailto:[hidden email]]
Sent: 17 July 2008 14:46
To: [hidden email]
Cc: [hidden email]
Subject: Re: Problem with openjpa enhancer - using runtime enhancement

Gareth,
It still seems like the -javaagent is not taking effect.  What version
of the surefire plugin are you using?  If it's 2.3, you might be hitting
the problem in this Issue:
http://jira.codehaus.org/browse/SUREFIRE-297.  The initial description
sounds exactly like your situation.

Can you run your maven script with debug (-X) to see exactly what jvm
arguments are being passed to the process?

Sorry that I'm still grabbing at straws, but I have not been able to
reproduce the situation yet.  I run with a javaagent for most of my
testing and haven't experienced this problem.

Thanks for your patience,
Kevin


On Thu, Jul 17, 2008 at 3:40 AM, Gareth Davies
<[hidden email]>
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.parseExceptio
> n(
> AbstractExpressionBuilder.java:118)
>        at
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getClassMetaData(
> JP
> QLExpressionBuilder.java:180)
>        at
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.resolveClassMetaD
> at
> a(JPQLExpressionBuilder.java:150)
>        at
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateMetaD
> at
> a(JPQLExpressionBuilder.java:225)
>        at
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateMetaD
> at
> 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(JPQLEx
> pr
> essionBuilder.java:69)
>        at
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder$ParsedJPQL.popula
> te
> (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.ja
> va
> :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(Searc
> hF
> ormPersistenceTestCase.java:6
> 7)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.j
> av
> a:39)
>        at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccess
> or
> 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.j
> av
> a:39)
>        at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccess
> or
> 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.executeTest
> Se
> t(AbstractDirectoryTestSuite.java:138)
>        at
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(Abs
> tr
> 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.j
> av
> a:39)
>        at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccess
> or
> Impl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:585)
>        at
> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(Sur
> ef
> ireBooter.java:308)
>        at
> org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.ja
> va
> :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 "com.par.impl.User@32316171".
> 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:1
> 64
> 6)
>        at
> org.apache.openjpa.meta.ClassMetaData.resolve(ClassMetaData.java:1620)
>        at
> org.apache.openjpa.meta.MetaDataRepository.processBuffer(MetaDataRepos
> it
> ory.java:717)
>        at
> org.apache.openjpa.meta.MetaDataRepository.resolveMeta(MetaDataReposit
> or
> y.java:616)
>        at
> org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.
> ja
> va:541)
>        at
> org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataReposit
> or
> y.java:308)
>        at
> org.apache.openjpa.meta.MetaDataRepository.resolveMeta(MetaDataReposit
> or
> y.java:581)
>        at
> org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.
> ja
> va:541)
>        at
> org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataReposit
> or
> 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(MetaDataReposit
> or
> y.java:581)
>        at
> org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.
> ja
> va:541)
>        at
> org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataReposit
> or
> 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(EntityManagerIm
> pl
> .java:769)
>        at
> com.par.impl.UserPersistenceTestCase.testUserManager(UserPersistenceTe
> st
> Case.java:30)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.j
> av
> a:39)
>        at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccess
> or
> 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.j
> av
> a:39)
>        at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccess
> or
> 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.executeTest
> Se
> t(AbstractDirectoryTestSuite.java:138)
>        at
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(Abs
> tr
> 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.j
> av
> a:39)
>        at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccess
> or
> Impl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:585)
>        at
> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(Sur
> ef
> ireBooter.java:308)
>        at
> org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.ja
> va
> :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.prepareUnenhancedCla
> ss
> es(ManagedClassSubclasser.java:102)
>        at
> org.apache.openjpa.kernel.AbstractBrokerFactory.loadPersistentTypes(Ab
> st
> ractBrokerFactory.java:310)
>        at
> org.apache.openjpa.kernel.AbstractBrokerFactory.initializeBroker(Abstr
> ac
> tBrokerFactory.java:228)
>        at
> org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrok
> er
> Factory.java:190)
>        at
> org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(Delegating
> Br
> okerFactory.java:142)
>        at
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityMa
> na
> ger(EntityManagerFactoryImpl.java:192)
>        at
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityMa
> na
> ger(EntityManagerFactoryImpl.java:145)
>        at
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityMa
> na
> ger(EntityManagerFactoryImpl.java:56)
>        at
> com.par.impl.SearchFormPersistenceTestCase.testSearchForm(SearchFormPe
> rs
> istenceTestCase.java:17)
>        at
> com.par.impl.SearchFormPersistenceTestCase.testSearchForm(SearchFormPe
> rs
> istenceTestCase.java:17)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.j
> av
> a:39)
>        at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccess
> or
> 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.j
> av
> a:39)
>        at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccess
> or
> 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.executeTest
> Se
> t(AbstractDirectoryTestSuite.java:138)
>        at
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(Abs
> tr
> 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.j
> av
> a:39)
>        at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccess
> or
> Impl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:585)
>        at
> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(Sur
> ef
> ireBooter.java:308)
>        at
> org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.ja
> va
> :879)
>
>
>
> -----Original Message-----
> From: Kevin Sutter [mailto:[hidden email]]
> Sent: 16 July 2008 18:30
> To: [hidden email]; [hidden email]
> 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
> <[hidden email]>
> 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:[hidden email]]
> > Sent: 16 July 2008 16:30
> > To: [hidden email]
> > 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
> > <[hidden email]>
> > 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:[hidden email]]
> > > Sent: 16 July 2008 15:46
> > > To: [hidden email]
> > > 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
> > > <[hidden email]>
> > > 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
> > > >
> > >
> >
>
Michael Dick

Fwd: Problem with openjpa enhancer - using runtime enhancement

Reply Threaded More More options
Print post
Permalink
In reply to this post by David Blevins
Forwarding to the OpenJPA users list.

---------- Forwarded message ----------
From: Dain Sundstrom <[hidden email]>
Date: Thu, Jul 17, 2008 at 2:07 PM
Subject: Re: Problem with openjpa enhancer - using runtime enhancement
To: [hidden email]


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
>> "com.par.impl.User@32316171".
>> 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:[hidden email]]
>> Sent: 16 July 2008 18:30
>> To: [hidden email]; [hidden email]
>> 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
>> <[hidden email]>
>> 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:[hidden email]]
>>> Sent: 16 July 2008 16:30
>>> To: [hidden email]
>>> 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
>>> <[hidden email]>
>>> 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:[hidden email]]
>>>> Sent: 16 July 2008 15:46
>>>> To: [hidden email]
>>>> 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
>>>> <[hidden email]>
>>>> 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
>>>>>
>>>>>
>>>>
>>>
>>
>
mikedd

Re: Problem with openjpa enhancer - using runtime enhancement

Reply Threaded More More options
Print post
Permalink
In reply to this post by Gareth Davies
Hi Gareth,

Sorry for coming into this thread late.

I've never had much luck getting the javaagent to run with Surefire either.
In your original email you mentioned that you were interested in running the
static enhancer with maven. We (OpenJPA) do this in our builds by using the
maven-ant-plugin. Ive used this approach in other projects as well.

Here's an example :
         . . .
            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>test-compile</phase>
                        <configuration>
                            <tasks>
                                <path id="cp">
                                    <path refid="maven.test.classpath" />
                                    <path refid="maven.compile.classpath" />
                                    <path refid="maven.dependency.classpath"
/>
                                </path>
                                <java

classname="org.apache.openjpa.enhance.PCEnhancer"
                                    classpathref="cp"
                                    dir="target/classes" fork="true">
                                </java>
                            </tasks>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        . . .

What this does is enhance all the entities in the target/classes. If you
have entities in the test directory your might want to get a bit more
clever.

An example off the top of my head (syntax errors and all ) :

            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>test-compile</phase>
                        <configuration>
                            <tasks>
                                <path id="cp">
                                    <path refid="maven.test.classpath" />
                                    <path refid="maven.compile.classpath" />
                                    <path refid="maven.dependency.classpath"
/>
                                </path>
                                <fileset id="enhance.path.ref"
                                           dir=".">  <!-- replace this with
the maven property for project root -->
                                     <include
name="target/test-classes/**/*.class" />
                                     <include name="target/test/**/*.class"
/>
                                     <!-- add any other includes or excludes
needed -->
                                </fileset>
                                <java

classname="org.apache.openjpa.enhance.PCEnhancer"
                                    classpathref="cp"
                                    dir="target/classes" fork="true">
                                </java>
                            </tasks>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

If you want to see exactly what we use in the OpenJPA builds you can take a
look at
http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/main/ant/enhancer.xml?revision=619770&view=markup.
This ant file includes code that prevents the enhancer from executing if you
specify -Dmaven.test.skip=true or -Dtest=false when you run maven. It's
probably overkill for most projects IMHO.

Hope this helps,

-mike

On Fri, Jul 18, 2008 at 8:45 AM, Gareth Davies <[hidden email]>
wrote:

> Kevin,
>
> We were using the surefire plugin version 2.3.1, but I have now changed
> it to the most recent version, 2.4.3.
>
> I agree about the javaagent, I have run the project with debug enabled
> and this is the output:
>
> Forking command line: cmd.exe /X /C ""c:\Program
> Files\Java\jdk1.5.0_15\jre\bin\java" -Xmx256m -jar
> C:\Users\GDAVIE~1.MSO\App
> Data\Local\Temp\surefirebooter22470.jar
> C:\Users\GDAVIE~1.MSO\AppData\Local\Temp\surefire22468tmp
> C:\Users\GDAVIE~1.MSO\AppDa
> ta\Local\Temp\surefire22469tmp"
>
> There is no mention of the javaagent anywhere in the output.
>
> So I had a look around in the pom, I realised that the argument -Xmx256m
> being passed into this command was coming from the parent pom, so I
> added the relevant arguments to that pom, i.e.
> -javaagent:${project.build.directory}/openjpa-1.1.0.jar.  This led to
> the following command line:
>
>
> Forking command line: cmd.exe /X /C ""c:\Program
> Files\Java\jdk1.5.0_15\jre\bin\java"
> -javaagent:C:\Users\gdavies.MSOFT\works
> pace\e-ices-wasce\application-shared\target/openjpa-1.1.0.jar -jar
> C:\Users\GDAVIE~1.MSO\AppData\Local\Temp\surefirebooter353
> 46.jar C:\Users\GDAVIE~1.MSO\AppData\Local\Temp\surefire35344tmp
> C:\Users\GDAVIE~1.MSO\AppData\Local\Temp\surefire35345tmp"
> java.lang.reflect.InvocationTargetException
>
>
> This gave me the error message that it could not find
> org/apache/commons/collections/set/MapBackedSet:
>
>
> java.lang.reflect.InvocationTargetException
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
> a:39)
>        at
>
<snip>


> So I included the the apache commons collections jar file in the
> classpath as so:
>
>
> Forking command line: cmd.exe /X /C ""c:\Program
> Files\Java\jdk1.5.0_15\jre\bin\java" -cp
> C:\Users\gdavies.MSOFT\workspace\e-
> ices-wasce\application-shared\target/commons-collections-3.2.jar
> -javaagent:C:\Users\gdavies.MSOFT\workspace\e-ices-wasce\app
> lication-shared\target/openjpa-1.1.0.jar -jar
> C:\Users\GDAVIE~1.MSO\AppData\Local\Temp\surefirebooter6917.jar
> C:\Users\GDAVIE
> ~1.MSO\AppData\Local\Temp\surefire6915tmp
> C:\Users\GDAVIE~1.MSO\AppData\Local\Temp\surefire6916tmp"
>
>
> But it still gives me the same error...
>
>
> java.lang.reflect.InvocationTargetException
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at
>
<snip>


>
> I'm not sure why its not picking up the jar file and finding the class
> specified...
>
> So I thought I would try it with the open ejb javaagent as below:
>
>
> Forking command line: cmd.exe /X /C ""c:\Program
> Files\Java\jdk1.5.0_15\jre\bin\java"
> -javaagent:C:\Users\gdavies.MSOFT\works
> pace\e-ices-wasce\application-shared\target/openejb-javaagent-3.0.jar
> -jar C:\Users\GDAVIE~1.MSO\AppData\Local\Temp\surefireb
> ooter7501.jar C:\Users\GDAVIE~1.MSO\AppData\Local\Temp\surefire7499tmp
> C:\Users\GDAVIE~1.MSO\AppData\Local\Temp\surefire7500t
> mp"
>
>
> This time it processes the javaagent no problems but still does not
> enhance the classes, the initial error in the first test to fail is
> similar to last time without the javaagent:
>
>
> Tests run: 2, Failures: 1, Errors: 1, Skipped: 0, Time elapsed: 4.769
> sec <<< FAILURE!
> testSearchForm(com.par.impl.SearchFormPersistenceTestCase)  Time
> elapsed: 1.653 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.falcon.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)
>
> testSearchFormElement(com.par.impl.SearchFormPersistenceTestCase)  Time
> elapsed: 3.087 sec  <<< FAILURE!
> junit.framework.AssertionFailedError: 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
> "SearchFormElement" is not a recognized entity or identifier. Known
> entity names: []
>        at junit.framework.Assert.fail(Assert.java:47)
>         at
> com.par.impl.SearchFormPersistenceTestCase.testSearchFormElement(SearchF
> ormPersistenceTestCase.java:90)
>
>
>
> Thanks
>
> Gareth
>
> -----Original Message-----
> From: Kevin Sutter [mailto:[hidden email]]
> Sent: 17 July 2008 14:46
> To: [hidden email]
> Cc: [hidden email]
> Subject: Re: Problem with openjpa enhancer - using runtime enhancement
>
> Gareth,
> It still seems like the -javaagent is not taking effect.  What version
> of the surefire plugin are you using?  If it's 2.3, you might be hitting
> the problem in this Issue:
> http://jira.codehaus.org/browse/SUREFIRE-297.  The initial description
> sounds exactly like your situation.
>
> Can you run your maven script with debug (-X) to see exactly what jvm
> arguments are being passed to the process?
>
> Sorry that I'm still grabbing at straws, but I have not been able to
> reproduce the situation yet.  I run with a javaagent for most of my
> testing and haven't experienced this problem.
>
> Thanks for your patience,
> Kevin
>
>
> On Thu, Jul 17, 2008 at 3:40 AM, Gareth Davies
> <[hidden email]>
> 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.parseExceptio
> > n(
> > AbstractExpressionBuilder.java:118)
> >        at
> > org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getClassMetaData(
> > JP
> > QLExpressionBuilder.java:180)
> >        at
> > org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.resolveClassMetaD
> > at
> > a(JPQLExpressionBuilder.java:150)
> >        at
> > org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateMetaD
> > at
> > a(JPQLExpressionBuilder.java:225)
> >        at
> > org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateMetaD
> > at
> > 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(JPQLEx
> > pr
> > essionBuilder.java:69)
> >        at
> > org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder$ParsedJPQL.popula
> > te
> > (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.ja
> > va
> > :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(Searc
> > hF
> > ormPersistenceTestCase.java:6
> > 7)
> >        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >        at
> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.j
> > av
> > a:39)
> >        at
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccess
> > or
> > 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.j
> > av
> > a:39)
> >        at
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccess
> > or
> > 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.executeTest
> > Se
> > t(AbstractDirectoryTestSuite.java:138)
> >        at
> > org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(Abs
> > tr
> > 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.j
> > av
> > a:39)
> >        at
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccess
> > or
> > Impl.java:25)
> >        at java.lang.reflect.Method.invoke(Method.java:585)
> >        at
> > org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(Sur
> > ef
> > ireBooter.java:308)
> >        at
> > org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.ja
> > va
> > :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 "com.par.impl.User@32316171".
> > 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:1
> > 64
> > 6)
> >        at
> > org.apache.openjpa.meta.ClassMetaData.resolve(ClassMetaData.java:1620)
> >        at
> > org.apache.openjpa.meta.MetaDataRepository.processBuffer(MetaDataRepos
> > it
> > ory.java:717)
> >        at
> > org.apache.openjpa.meta.MetaDataRepository.resolveMeta(MetaDataReposit
> > or
> > y.java:616)
> >        at
> > org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.
> > ja
> > va:541)
> >        at
> > org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataReposit
> > or
> > y.java:308)
> >        at
> > org.apache.openjpa.meta.MetaDataRepository.resolveMeta(MetaDataReposit
> > or
> > y.java:581)
> >        at
> > org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.
> > ja
> > va:541)
> >        at
> > org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataReposit
> > or
> > 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(MetaDataReposit
> > or
> > y.java:581)
> >        at
> > org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.
> > ja
> > va:541)
> >        at
> > org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataReposit
> > or
> > 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(EntityManagerIm
> > pl
> > .java:769)
> >        at
> > com.par.impl.UserPersistenceTestCase.testUserManager(UserPersistenceTe
> > st
> > Case.java:30)
> >        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >        at
> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.j
> > av
> > a:39)
> >        at
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccess
> > or
> > 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.j
> > av
> > a:39)
> >        at
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccess
> > or
> > 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.executeTest
> > Se
> > t(AbstractDirectoryTestSuite.java:138)
> >        at
> > org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(Abs
> > tr
> > 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.j
> > av
> > a:39)
> >        at
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccess
> > or
> > Impl.java:25)
> >        at java.lang.reflect.Method.invoke(Method.java:585)
> >        at
> > org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(Sur
> > ef
> > ireBooter.java:308)
> >        at
> > org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.ja
> > va
> > :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.prepareUnenhancedCla
> > ss
> > es(ManagedClassSubclasser.java:102)
> >        at
> > org.apache.openjpa.kernel.AbstractBrokerFactory.loadPersistentTypes(Ab
> > st
> > ractBrokerFactory.java:310)
> >        at
> > org.apache.openjpa.kernel.AbstractBrokerFactory.initializeBroker(Abstr
> > ac
> > tBrokerFactory.java:228)
> >        at
> > org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrok
> > er
> > Factory.java:190)
> >        at
> > org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(Delegating
> > Br
> > okerFactory.java:142)
> >        at
> > org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityMa
> > na
> > ger(EntityManagerFactoryImpl.java:192)
> >        at
> > org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityMa
> > na
> > ger(EntityManagerFactoryImpl.java:145)
> >        at
> > org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityMa
> > na
> > ger(EntityManagerFactoryImpl.java:56)
> >        at
> > com.par.impl.SearchFormPersistenceTestCase.testSearchForm(SearchFormPe
> > rs
> > istenceTestCase.java:17)
> >        at
> > com.par.impl.SearchFormPersistenceTestCase.testSearchForm(SearchFormPe
> > rs
> > istenceTestCase.java:17)
> >        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >        at
> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.j
> > av
> > a:39)
> >        at
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccess
> > or
> > 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.j
> > av
> > a:39)
> >        at
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccess
> > or
> > 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.executeTest
> > Se
> > t(AbstractDirectoryTestSuite.java:138)
> >        at
> > org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(Abs
> > tr
> > 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.j
> > av
> > a:39)
> >        at
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccess
> > or
> > Impl.java:25)
> >        at java.lang.reflect.Method.invoke(Method.java:585)
> >        at
> > org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(Sur
> > ef
> > ireBooter.java:308)
> >        at
> > org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.ja
> > va
> > :879)
> >
> >
> >
> > -----Original Message-----
> > From: Kevin Sutter [mailto:[hidden email]]
> > Sent: 16 July 2008 18:30
> > To: [hidden email]; [hidden email]
> > 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
> > <[hidden email]>
> > 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:[hidden email]]
> > > Sent: 16 July 2008 16:30
> > > To: [hidden email]
> > > 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
> > > <[hidden email]>
> > > 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:[hidden email]]
> > > > Sent: 16 July 2008 15:46
> > > > To: [hidden email]
> > > > 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
> > > > <[hidden email]>
> > > > 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
> > > > >
> > > >
> > >
> >
>
Gareth Davies

RE: Problem with openjpa enhancer - using runtime enhancement

Reply Threaded More More options
Print post
Permalink
In reply to this post by Gareth Davies
Mike,

Thanks for your reply, I have tried the ant-run plugin as you suggested
and that seems to be working great.  It would have been nice to
understand why the surefire plugin wasn't working correctly with the
runtime enhancement, but I am happy to finally be able to run my test
cases without having to manually invoke the enhancer!

Thanks

Gareth

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On
Behalf Of Michael Dick
Sent: 18 July 2008 16:16
To: [hidden email]
Cc: [hidden email]
Subject: Re: Problem with openjpa enhancer - using runtime enhancement

Hi Gareth,

Sorry for coming into this thread late.

I've never had much luck getting the javaagent to run with Surefire
either.
In your original email you mentioned that you were interested in running
the static enhancer with maven. We (OpenJPA) do this in our builds by
using the maven-ant-plugin. Ive used this approach in other projects as
well.

Here's an example :
         . . .
            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>test-compile</phase>
                        <configuration>
                            <tasks>
                                <path id="cp">
                                    <path refid="maven.test.classpath"
/>
                                    <path
refid="maven.compile.classpath" />
                                    <path
refid="maven.dependency.classpath"
/>
                                </path>
                                <java

classname="org.apache.openjpa.enhance.PCEnhancer"
                                    classpathref="cp"
                                    dir="target/classes" fork="true">
                                </java>
                            </tasks>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        . . .

What this does is enhance all the entities in the target/classes. If you
have entities in the test directory your might want to get a bit more
clever.

An example off the top of my head (syntax errors and all ) :

            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>test-compile</phase>
                        <configuration>
                            <tasks>
                                <path id="cp">
                                    <path refid="maven.test.classpath"
/>
                                    <path
refid="maven.compile.classpath" />
                                    <path
refid="maven.dependency.classpath"
/>
                                </path>
                                <fileset id="enhance.path.ref"
                                           dir=".">  <!-- replace this
with the maven property for project root -->
                                     <include
name="target/test-classes/**/*.class" />
                                     <include
name="target/test/**/*.class"
/>
                                     <!-- add any other includes or
excludes needed -->
                                </fileset>
                                <java

classname="org.apache.openjpa.enhance.PCEnhancer"
                                    classpathref="cp"
                                    dir="target/classes" fork="true">
                                </java>
                            </tasks>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

If you want to see exactly what we use in the OpenJPA builds you can
take a look at
http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/
main/ant/enhancer.xml?revision=619770&view=markup.
This ant file includes code that prevents the enhancer from executing if
you specify -Dmaven.test.skip=true or -Dtest=false when you run maven.
It's probably overkill for most projects IMHO.

Hope this helps,

-mike

On Fri, Jul 18, 2008 at 8:45 AM, Gareth Davies
<[hidden email]>
wrote:

> Kevin,
>
> We were using the surefire plugin version 2.3.1, but I have now
> changed it to the most recent version, 2.4.3.
>
> I agree about the javaagent, I have run the project with debug enabled

> and this is the output:
>
> Forking command line: cmd.exe /X /C ""c:\Program
> Files\Java\jdk1.5.0_15\jre\bin\java" -Xmx256m -jar
> C:\Users\GDAVIE~1.MSO\App Data\Local\Temp\surefirebooter22470.jar
> C:\Users\GDAVIE~1.MSO\AppData\Local\Temp\surefire22468tmp
> C:\Users\GDAVIE~1.MSO\AppDa
> ta\Local\Temp\surefire22469tmp"
>
> There is no mention of the javaagent anywhere in the output.
>
> So I had a look around in the pom, I realised that the argument
> -Xmx256m being passed into this command was coming from the parent
> pom, so I added the relevant arguments to that pom, i.e.
> -javaagent:${project.build.directory}/openjpa-1.1.0.jar.  This led to
> the following command line:
>
>
> Forking command line: cmd.exe /X /C ""c:\Program
> Files\Java\jdk1.5.0_15\jre\bin\java"
> -javaagent:C:\Users\gdavies.MSOFT\works
> pace\e-ices-wasce\application-shared\target/openjpa-1.1.0.jar -jar
> C:\Users\GDAVIE~1.MSO\AppData\Local\Temp\surefirebooter353
> 46.jar C:\Users\GDAVIE~1.MSO\AppData\Local\Temp\surefire35344tmp
> C:\Users\GDAVIE~1.MSO\AppData\Local\Temp\surefire35345tmp"
> java.lang.reflect.InvocationTargetException
>
>
> This gave me the error message that it could not find
> org/apache/commons/collections/set/MapBackedSet:
>
>
> java.lang.reflect.InvocationTargetException
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.j
> av
> a:39)
>        at
>
<snip>


> So I included the the apache commons collections jar file in the
> classpath as so:
>
>
> Forking command line: cmd.exe /X /C ""c:\Program
> Files\Java\jdk1.5.0_15\jre\bin\java" -cp
> C:\Users\gdavies.MSOFT\workspace\e-
> ices-wasce\application-shared\target/commons-collections-3.2.jar
> -javaagent:C:\Users\gdavies.MSOFT\workspace\e-ices-wasce\app
> lication-shared\target/openjpa-1.1.0.jar -jar
> C:\Users\GDAVIE~1.MSO\AppData\Local\Temp\surefirebooter6917.jar
> C:\Users\GDAVIE
> ~1.MSO\AppData\Local\Temp\surefire6915tmp
> C:\Users\GDAVIE~1.MSO\AppData\Local\Temp\surefire6916tmp"
>
>
> But it still gives me the same error...
>
>
> java.lang.reflect.InvocationTargetException
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at
>
<snip>


>
> I'm not sure why its not picking up the jar file and finding the class

> specified...
>
> So I thought I would try it with the open ejb javaagent as below:
>
>
> Forking command line: cmd.exe /X /C ""c:\Program
> Files\Java\jdk1.5.0_15\jre\bin\java"
> -javaagent:C:\Users\gdavies.MSOFT\works
> pace\e-ices-wasce\application-shared\target/openejb-javaagent-3.0.jar
> -jar C:\Users\GDAVIE~1.MSO\AppData\Local\Temp\surefireb
> ooter7501.jar C:\Users\GDAVIE~1.MSO\AppData\Local\Temp\surefire7499tmp
> C:\Users\GDAVIE~1.MSO\AppData\Local\Temp\surefire7500t
> mp"
>
>
> This time it processes the javaagent no problems but still does not
> enhance the classes, the initial error in the first test to fail is
> similar to last time without the javaagent:
>
>
> Tests run: 2, Failures: 1, Errors: 1, Skipped: 0, Time elapsed: 4.769
> sec <<< FAILURE!
> testSearchForm(com.par.impl.SearchFormPersistenceTestCase)  Time
> elapsed: 1.653 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.falcon.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.prepareUnenhancedCla
> ss
> es(ManagedClassSubclasser.java:102)
>        at
> org.apache.openjpa.kernel.AbstractBrokerFactory.loadPersistentTypes(Ab
> st
> ractBrokerFactory.java:310)
>        at
> org.apache.openjpa.kernel.AbstractBrokerFactory.initializeBroker(Abstr
> ac
> tBrokerFactory.java:228)
>        at
> org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrok
> er
> Factory.java:190)
>        at
> org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(Delegating
> Br
> okerFactory.java:142)
>        at
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityMa
> na
> ger(EntityManagerFactoryImpl.java:192)
>        at
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityMa
> na
> ger(EntityManagerFactoryImpl.java:145)
>        at
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityMa
> na
> ger(EntityManagerFactoryImpl.java:56)
>        at
> com.par.impl.SearchFormPersistenceTestCase.testSearchForm(SearchFormPe
> rs
> istenceTestCase.java:17)
>
> testSearchFormElement(com.par.impl.SearchFormPersistenceTestCase)  
> Time
> elapsed: 3.087 sec  <<< FAILURE!
> junit.framework.AssertionFailedError: 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
> "SearchFormElement" is not a recognized entity or identifier. Known
> entity names: []
>        at junit.framework.Assert.fail(Assert.java:47)
>         at
> com.par.impl.SearchFormPersistenceTestCase.testSearchFormElement(Searc
> hF
> ormPersistenceTestCase.java:90)
>
>
>
> Thanks
>
> Gareth
>
> -----Original Message-----
> From: Kevin Sutter [mailto:[hidden email]]
> Sent: 17 July 2008 14:46
> To: [hidden email]
> Cc: [hidden email]
> Subject: Re: Problem with openjpa enhancer - using runtime enhancement
>
> Gareth,
> It still seems like the -javaagent is not taking effect.  What version

> of the surefire plugin are you using?  If it's 2.3, you might be
> hitting the problem in this Issue:
> http://jira.codehaus.org/browse/SUREFIRE-297.  The initial description

> sounds exactly like your situation.
>
> Can you run your maven script with debug (-X) to see exactly what jvm
> arguments are being passed to the process?
>
> Sorry that I'm still grabbing at straws, but I have not been able to
> reproduce the situation yet.  I run with a javaagent for most of my
> testing and haven't experienced this problem.
>
> Thanks for your patience,
> Kevin
>
>
> On Thu, Jul 17, 2008 at 3:40 AM, Gareth Davies
> <[hidden email]>
> 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.parseExcept
> > io
> > n(
> > AbstractExpressionBuilder.java:118)
> >        at
> > org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getClassMetaDat
> > a(
> > JP
> > QLExpressionBuilder.java:180)
> >        at
> > org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.resolveClassMet
> > aD
> > at
> > a(JPQLExpressionBuilder.java:150)
> >        at
> > org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateMet
> > aD
> > at
> > a(JPQLExpressionBuilder.java:225)
> >        at
> > org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateMet
> > aD
> > at
> > a(JPQLExpressionBuilder.java:195)
> >        at
> > org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateTyp
> > e(
> > JP
> > QLExpressionBuilder.java:188)
> >        at
> > org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.access$600(JPQL
> > Ex
> > pr
> > essionBuilder.java:69)
> >        at
> > org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder$ParsedJPQL.popu
> > la
> > te
> > (JPQLExpressionBuilder.java:1754)
> >        at
> >
org.apache.openjpa.kernel.jpql.JPQLParser.populate(JPQLParser.java:56)
> >        at
> > org.apache.openjpa.kernel.ExpressionStoreQuery.populateFromCompilati
> > on
> > (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.
> > ja
> > va
> > :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(DelegatingQue
> > ry
> > .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(Sea
> > rc
> > hF
> > ormPersistenceTestCase.java:6
> > 7)
> >        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)

> >        at
> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl
> > .j
> > av
> > a:39)
> >        at
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcce
> > ss
> > or
> > 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
> > .j
> > av
> > a:39)
> >        at
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcce
> > ss
> > or
> > Impl.java:25)
> >        at java.lang.reflect.Method.invoke(Method.java:585)
> >        at
> > org.apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.ja
> > va
> > :2
> > 13)
> >        at
> > org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTe
> > st
> > Se
> > t(AbstractDirectoryTestSuite.java:138)
> >        at
> > org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(A
> > bs
> > tr
> > 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
> > .j
> > av
> > a:39)
> >        at
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcce
> > ss
> > or
> > Impl.java:25)
> >        at java.lang.reflect.Method.invoke(Method.java:585)
> >        at
> > org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(S
> > ur
> > ef
> > ireBooter.java:308)
> >        at
> > org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.
> > ja
> > va
> > :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 "com.par.impl.User@32316171".
> > 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
> > :1
> > 64
> > 6)
> >        at
> >
org.apache.openjpa.meta.ClassMetaData.resolve(ClassMetaData.java:1620)

> >        at
> > org.apache.openjpa.meta.MetaDataRepository.processBuffer(MetaDataRep
> > os
> > it
> > ory.java:717)
> >        at
> > org.apache.openjpa.meta.MetaDataRepository.resolveMeta(MetaDataRepos
> > it
> > or
> > y.java:616)
> >        at
> >
org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.

> > ja
> > va:541)
> >        at
> > org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepos
> > it
> > or
> > y.java:308)
> >        at
> > org.apache.openjpa.meta.MetaDataRepository.resolveMeta(MetaDataRepos
> > it
> > or
> > y.java:581)
> >        at
> >
org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.

> > ja
> > va:541)
> >        at
> > org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepos
> > it
> > or
> > 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(MetaDataRepos
> > it
> > or
> > y.java:581)
> >        at
> >
org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.
> > ja
> > va:541)
> >        at
> > org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepos
> > it
> > or
> > 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(EntityManager
> > Im
> > pl
> > .java:769)
> >        at
> > com.par.impl.UserPersistenceTestCase.testUserManager(UserPersistence
> > Te
> > st
> > Case.java:30)
> >        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)

> >        at
> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl
> > .j
> > av
> > a:39)
> >        at
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcce
> > ss
> > or
> > 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
> > .j
> > av
> > a:39)
> >        at
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcce
> > ss
> > or
> > Impl.java:25)
> >        at java.lang.reflect.Method.invoke(Method.java:585)
> >        at
> > org.apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.ja
> > va
> > :2
> > 13)
> >        at
> > org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTe
> > st
> > Se
> > t(AbstractDirectoryTestSuite.java:138)
> >        at
> > org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(A
> > bs
> > tr
> > 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
> > .j
> > av
> > a:39)
> >        at
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcce
> > ss
> > or
> > Impl.java:25)
> >        at java.lang.reflect.Method.invoke(Method.java:585)
> >        at
> > org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(S
> > ur
> > ef
> > ireBooter.java:308)
> >        at
> > org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.
> > ja
> > va
> > :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.prepareUnenhancedC
> > la
> > ss
> > es(ManagedClassSubclasser.java:102)
> >        at
> > org.apache.openjpa.kernel.AbstractBrokerFactory.loadPersistentTypes(
> > Ab
> > st
> > ractBrokerFactory.java:310)
> >        at
> > org.apache.openjpa.kernel.AbstractBrokerFactory.initializeBroker(Abs
> > tr
> > ac
> > tBrokerFactory.java:228)
> >        at
> > org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBr
> > ok
> > er
> > Factory.java:190)
> >        at
> > org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(Delegati
> > ng
> > Br
> > okerFactory.java:142)
> >        at
> > org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntity
> > Ma
> > na
> > ger(EntityManagerFactoryImpl.java:192)
> >        at
> > org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntity
> > Ma
> > na
> > ger(EntityManagerFactoryImpl.java:145)
> >        at
> > org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntity
> > Ma
> > na
> > ger(EntityManagerFactoryImpl.java:56)
> >        at
> > com.par.impl.SearchFormPersistenceTestCase.testSearchForm(SearchForm
> > Pe
> > rs
> > istenceTestCase.java:17)
> >        at
> > com.par.impl.SearchFormPersistenceTestCase.testSearchForm(SearchForm
> > Pe
> > rs
> > istenceTestCase.java:17)
> >        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)

> >        at
> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl
> > .j
> > av
> > a:39)
> >        at
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcce
> > ss
> > or
> > 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
> > .j
> > av
> > a:39)
> >        at
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcce
> > ss
> > or
> > Impl.java:25)
> >        at java.lang.reflect.Method.invoke(Method.java:585)
> >        at
> > org.apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.ja
> > va
> > :2
> > 13)
> >        at
> > org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTe
> > st
> > Se
> > t(AbstractDirectoryTestSuite.java:138)
> >        at
> > org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(A
> > bs
> > tr
> > 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
> > .j
> > av
> > a:39)
> >        at
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcce
> > ss
> > or
> > Impl.java:25)
> >        at java.lang.reflect.Method.invoke(Method.java:585)
> >        at
> > org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(S
> > ur
> > ef
> > ireBooter.java:308)
> >        at
> > org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.
> > ja
> > va
> > :879)
> >
> >
> >
> > -----Original Message-----
> > From: Kevin Sutter [mailto:[hidden email]]
> > Sent: 16 July 2008 18:30
> > To: [hidden email]; [hidden email]
> > 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
> > <[hidden email]>
> > 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:[hidden email]]
> > > Sent: 16 July 2008 16:30
> > > To: [hidden email]
> > > 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
> > > <[hidden email]>
> > > 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:[hidden email]]
> > > > Sent: 16 July 2008 15:46
> > > > To: [hidden email]
> > > > 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
> > > > <[hidden email]>
> > > > 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
> > > > >
> > > >
> > >
> >
>