openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "John Ross (JIRA)" <>
Subject [jira] [Created] (OPENJPA-2342) Consider modifying to use serp.bytecode.BCClass.getDeclaredInterfaceNames instead of getDeclaredInterfaceTypes.
Date Wed, 27 Feb 2013 16:59:12 GMT
John Ross created OPENJPA-2342:

             Summary: Consider modifying to use serp.bytecode.BCClass.getDeclaredInterfaceNames
instead of getDeclaredInterfaceTypes.
                 Key: OPENJPA-2342
             Project: OpenJPA
          Issue Type: Improvement
          Components: Enhance
    Affects Versions: 2.2.2
            Reporter: John Ross

Caused by: <openjpa-2.2.2-SNAPSHOT-r422266:1446295 nonfatal general error> org.apache.openjpa.util.GeneralException:
An error occurred while enhancing itemjpa.ItemJPA. Exception message: java.lang.ClassNotFoundException:
    at org.apache.openjpa.enhance.PCClassFileTransformer.transform0(
    at org.apache.openjpa.enhance.PCClassFileTransformer.transform(
    at org.apache.openjpa.persistence.PersistenceProviderImpl$ClassTransformerImpl.transform(
    at org.apache.aries.jpa.container.weaving.impl.WrappingTransformer.transform(
    at org.apache.aries.jpa.container.weaving.impl.JPAWeavingHook.weave(
    ... 48 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassNotFoundException: org.apache.aries.proxy.weaving.WovenProxy
    at serp.util.Strings.toClass(
    at serp.util.Strings.toClass(
    at serp.bytecode.BCClass.getDeclaredInterfaceTypes(
    ... 53 more

This issue occurs when the Apache Aries Proxy weaving hook gets called before the Apache Aries
JPA weaving hook. Proxy weaves the class with the WovenProxy interface and adds the necessary
dynamic package imports. JPA then gets called and uses PCEnhancer which, in turn, calls BCClass.getDeclaredInterfaceTypes,
which ultimately calls Class.forName using the woven interface's name. The class loader is
from the bundle whose class is being woven. Per the OSGi spec, dynamic imports do not take
effect until after the entire weaving process is complete. Consequently, the bundle's class
loader does not yet have visibility to the class.

One solution to this, at least in the Aries case, is to order the weaving hook calls using
the osgi service ranking property. However, all weaving hook services with potential conflicts
may not be under the control of the same entity.

Basically, is using the information from BCClass to determine whether or not
the class has already been woven. It's only interested in knowing if the PersistenceCapable
interface is there. It seems that BCClass.getDeclaredInterfaceNames avoids the Class.forName
call and could be used instead, particularly considering that only the class names are compared.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

View raw message