[ 
https://issues.apache.org/jira/browse/OPENJPA-1891?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Xavi Arias updated OPENJPA-1891:
--------------------------------

    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.



  was:
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 
com.rhodia.interactive.domain.model.profile.MyFavorite" to be 
persistence-capable, then this means that OpenJPA could not find any metadata 
for "class com.rhodia.interactive.domain.model.profile.MyFavorite". 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.




> PCEnhancer does not find meta data for entities using annotations
> -----------------------------------------------------------------
>
>                 Key: OPENJPA-1891
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1891
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: Enhance
>    Affects Versions: 1.2.2
>         Environment: Windows XP SP2
> Spring 2.5.6
> Tomcat 6.0.28
>            Reporter: Xavi Arias
>            Priority: Minor
>
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to