Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Not A Problem
-
1.2.2
-
None
-
None
-
Windows XP SP2
Spring 2.5.6
Tomcat 6.0.28
Description
The problem comes while enhancing entities at runtime by the Spring load time weaver mechanism.
Spring load time weaver is configured with "org.springframework.instrument.classloading.ReflectiveLoadTimeWeaver" and Tomcat webapp class loader with "org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader". Everything works without any exception, but the enhancer does not find any entity meta data. The log message for every entity is the following:
18:09:24,431 WARN openjpa.Enhance - Type "class model.Contact" has no metadata; enhancing as persistence aware. If you intended for "class model.Contact" to be persistence-capable, then this means that OpenJPA could not find any metadata for "class model.Contact". This can happen if the directory containing your metadata is not in your CLASSPATH, or if your metadata files are not named properly. See the documentation on metadata placement for more information.
After debugging, that the problem seems to come from the method parseClassAnnotations in AnnotationPersistenceMetaDataParser. The call to J2DoPriv5Helper.isAnnotationPresentAction(_cls, Entity.class) always return false, while the class is actually annotated as an entity. This is because the javax.persistence.Entity class passed as parameter is not the same as the one in the entity class annotation map, so the subsequent call to getAnnotation(Entity.class) always returns null.