openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin Sutter <>
Subject Re: enhancement roadblock
Date Fri, 06 Feb 2009 15:45:01 GMT
Hi Adam,
You are right in your thinking not to use the "fall back" enhancement
processing for production use.  It was meant as an easy "out of the box"
experience for simple apps.  It was not meant for production use.  All of
this has been documented in our forums and JIRAs (which you have already

We are doing more investigation into the Java 6 class redefinition support.
This doesn't seem to be 100% complete either, at least for some scenarios.

So, the best bet (and most proven) is to stick with standard PCEnhancement.
This can be done in several ways -- statically during build, or dynamically
via the -javaagent approach or tied into the classloader of a suitable EJB3

In the WebSphere environment, the classloader enhancement process is tied
into both the EJB and Web Containers (same Java EE runtime implementation).
But, it doesn't sound like this linkage is provided by Tomcat.  I have no
direct experience with Tomcat -- just reading your note below.

So, it sounds like your best approach is to do the enhancement during the
build process.  If you are experiencing un-enhanced entities at runtime,
then either your build-time enhancement is not working, or your packaged
application isn't picking up the enhanced classes, or you accidentally have
non-enhanced entities also available via your Tomcat environment.

Because we don't want our WebSphere customers to accidentally use the "fall
back" enhancement, we actually turn this off for OpenJPA within WebSphere.
You can do this with this property in your persistence.xml file:

openjpa.RuntimeUnenhancedClasses = warn

By default, this is set to "supported".  Another value is "unsupported",
which just detects the problem a little earlier.  By using "warn", you still
won't fall into the "fall back" enhancement and you will get some more
helpful messages concerning the entities that have not been enhanced.

I don't have a specific, complete answer to your situation.  But, maybe if
you can experiment a bit with the above information and provide some more
details, we can help get your environment working to your expectations.
Good luck!


On Fri, Feb 6, 2009 at 9:05 AM, Adam Hardy <>wrote:

> I need to enhance the entities in my current project because otherwise with
> 'fall-back' enhancement, the core functionality of the application cannot be
> run, due to StackOverflowErrors (because of the large number of unenhanced
> entities that OpenJPA has to deal with, according to JIRA and the mailing
> list archives).
> I'm running Java 1.6.0_12 so I think I'm right in saying that the runtime
> enhancement used by OpenJPA on the unenhanced entities will be Java 6 class
> retransformation - but it's causing the issue above.
> I have tried specifying the javaagent as a JVM option, but I have some
> problems with this in the web server. I'm using tomcat and it looks like I
> have to put my complete webapp into tomcat shared directory so that the
> enhancement process has the classes available at boot.
> My entity beans have a fair amount of encapsulated business logic so there
> are a fair number of external utility classes and jar dependencies.
> Is there a way to configure the javaagent on a per-website basis for
> tomcat?
> Secondly I have configured the openjpa-maven-plugin so that it launches the
> PCEnhancer during my maven build, but the x*?!"@ app doesn't run with the
> build-time enhanced classes.
> It just hangs while loading the webapp, when Spring tries to load the
> managers (the transaction-wrapped business tier). That's both during
> integration testing with JUnit and when deployed in tomcat.
> I think that sums up my current situation. Can anyone suggest a way
> forward?
> regards
> Adam

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message