openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Beyer,Nathan" <NBE...@CERNER.COM>
Subject RE: Problem with openjpa enhancer - using runtime enhancement
Date Wed, 16 Jul 2008 20:21:51 GMT
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:kwsutter@gmail.com] 
Sent: Wednesday, July 16, 2008 11:45 AM
To: users@openjpa.apache.org; users@openejb.apache.org
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 <Gareth.Davies@msoft.co.uk>
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:kwsutter@gmail.com]
> Sent: 16 July 2008 16:30
> To: users@openjpa.apache.org
> 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
> <Gareth.Davies@msoft.co.uk>
> 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:kwsutter@gmail.com]
> > Sent: 16 July 2008 15:46
> > To: users@openjpa.apache.org
> > 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
> > <Gareth.Davies@msoft.co.uk>
> > 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.

Mime
View raw message