Return-Path: X-Original-To: apmail-openjpa-dev-archive@www.apache.org Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B995FEF40 for ; Wed, 27 Feb 2013 16:59:12 +0000 (UTC) Received: (qmail 13699 invoked by uid 500); 27 Feb 2013 16:59:12 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 13636 invoked by uid 500); 27 Feb 2013 16:59:12 -0000 Mailing-List: contact dev-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openjpa.apache.org Delivered-To: mailing list dev@openjpa.apache.org Received: (qmail 13623 invoked by uid 99); 27 Feb 2013 16:59:12 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 Feb 2013 16:59:12 +0000 Date: Wed, 27 Feb 2013 16:59:12 +0000 (UTC) From: "John Ross (JIRA)" To: dev@openjpa.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (OPENJPA-2342) Consider modifying PCEnhancer.run to use serp.bytecode.BCClass.getDeclaredInterfaceNames instead of getDeclaredInterfaceTypes. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 John Ross created OPENJPA-2342: ---------------------------------- Summary: Consider modifying PCEnhancer.run to use serp.bytecod= e.BCClass.getDeclaredInterfaceNames instead of getDeclaredInterfaceTypes. Key: OPENJPA-2342 URL: https://issues.apache.org/jira/browse/OPENJPA-2342 Project: OpenJPA Issue Type: Improvement Components: Enhance Affects Versions: 2.2.2 Reporter: John Ross Caused by: = org.apache.openjpa.util.GeneralException: An error occurred while enhancing= itemjpa.ItemJPA. Exception message: java.lang.ClassNotFoundException: org.= apache.aries.proxy.weaving.WovenProxy =C2=A0=C2=A0=C2=A0 at org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.= java:578) =C2=A0=C2=A0=C2=A0 at org.apache.openjpa.enhance.PCClassFileTransformer.tra= nsform0(PCClassFileTransformer.java:153) =C2=A0=C2=A0=C2=A0 at org.apache.openjpa.enhance.PCClassFileTransformer.tra= nsform(PCClassFileTransformer.java:126) =C2=A0=C2=A0=C2=A0 at org.apache.openjpa.persistence.PersistenceProviderImp= l$ClassTransformerImpl.transform(PersistenceProviderImpl.java:290) =C2=A0=C2=A0=C2=A0 at org.apache.aries.jpa.container.weaving.impl.WrappingT= ransformer.transform(WrappingTransformer.java:80) =C2=A0=C2=A0=C2=A0 at org.apache.aries.jpa.container.weaving.impl.JPAWeavin= gHook.weave(JPAWeavingHook.java:71) =C2=A0=C2=A0=C2=A0 ... 48 more Caused by: java.lang.IllegalArgumentException: java.lang.ClassNotFoundExcep= tion: org.apache.aries.proxy.weaving.WovenProxy =C2=A0=C2=A0=C2=A0 at serp.util.Strings.toClass(Strings.java:164) =C2=A0=C2=A0=C2=A0 at serp.util.Strings.toClass(Strings.java:108) =C2=A0=C2=A0=C2=A0 at serp.bytecode.BCClass.getDeclaredInterfaceTypes(BCCla= ss.java:740) =C2=A0=C2=A0=C2=A0 at org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.= java:537) =C2=A0=C2=A0=C2=A0 ... 53 more This issue occurs when the Apache Aries Proxy weaving hook gets called befo= re the Apache Aries JPA weaving hook. Proxy weaves the class with the Woven= Proxy interface and adds the necessary dynamic package imports. JPA then ge= ts called and uses PCEnhancer which, in turn, calls BCClass.getDeclaredInte= rfaceTypes, 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 w= eaving process is complete. Consequently, the bundle's class loader does no= t yet have visibility to the class. One solution to this, at least in the Aries case, is to order the weaving h= ook calls using the osgi service ranking property. However, all weaving hoo= k services with potential conflicts may not be under the control of the sam= e entity. Basically, PCEnhancer.run is using the information from BCClass to determin= e 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 administrato= rs For more information on JIRA, see: http://www.atlassian.com/software/jira