openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Divya K Konoor <>
Subject RE: Entitiy not enhanced
Date Wed, 25 Sep 2013 15:15:04 GMT


I tried by manually adding the java agent in my jvm options  -javaagent:/
apache-openjpa-2.2.2/lib/openjpa-all-2.2.2.jar following examples 5.2 and
5.3 under section 2.3 at

 But even that hasn't helped .I still get the entity not enhanced problem.


From:	Divya K Konoor/India/IBM
Date:	09/25/2013 07:19 PM
Subject:	Entitiy not enhanced


I use a container (Webshphere liberty that internally uses openjpa). I have
multiple OSGi persistence bundles .Each has its own persistence unit ; all
of these talk to the same database.The JPA entities bundled within each
persistence bundle is defined under the <class></class> tag of the
persistence.xml. Some of these entities have relationship or dependency on
the entities bundled with another persistence bundle in which case the
dependent entities are added in the <class> tag of the former's

I see the following error message when I start my liberty server:

This configuration disallows runtime optimization, but the following listed
types were not enhanced at build time or at class load time with a
javaagent: "

[err] <openjpa- fatal user error>
org.apache.openjpa.persistence.ArgumentException: The type "class" has not been enhanced.
[err] 	at org.apache.openjpa.meta.ClassMetaData.resolveMeta
[err] 	at org.apache.openjpa.meta.ClassMetaData.resolve
[err] 	at org.apache.openjpa.meta.MetaDataRepository.processBuffer
[err] 	at org.apache.openjpa.meta.MetaDataRepository.resolveMeta
[err] 	at org.apache.openjpa.meta.MetaDataRepository.resolve
[err] 	at
[err] 	at org.apache.openjpa.meta.MetaDataRepository.getMetaData
[err] 	at org.apache.openjpa.meta.MetaDataRepository.resolveAll
[err] 	at
[err] 	at org.apache.openjpa.meta.MetaDataRepository.getQueryMetaData
[err] 	at

There is a brief mention of this here (but it doesn't explain why):

I was under the impression that openjpa does runtime enhancement on all JPA
entities that have not been enhanced. The above log statement seems to
indicate that one or more JPA entities have not been enhanced during
runtime.I saw a brief mention about this at

"If a javaagent is not provided via the command line and OpenJPA is running
on the Sun 1.6 SDK or IBM 1.6 JDK (SR8+), OpenJPA will attempt to
dynamically load the Enhancer that was mentioned in the previous section.
This support is provided as an ease of use feature and it is not
recommended for use in a production system. Using this method of
enhancement has the following caveats:
The dynamic runtime enhancer is plugged into the JVM during creation of the
EntityManagerFactory. Any Entity classes that are loaded before the
EntityManagerFactory is created will not be enhanced. "

I also noticed the following in the logs:

openjpa.DynamicEnhancementAgent: false .

I was expecting it to me openjpa.DynamicEnhancementAgent: true .

I manually added the following jvm option
-Dopenjpa.DynamicEnhancementAgent=true after which the logs show
openjpa.DynamicEnhancementAgent: true but I hit the same entitiy not
enhanced issue.

Apart from build time enhancement , is there anything that can be done to
ensure that all JPA entities are enhanced during runtime.


View raw message