aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwr...@apache.org
Subject svn commit: r1451781 - /aries/trunk/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/weaving/impl/TransformerRegistryFactory.java
Date Fri, 01 Mar 2013 23:45:34 GMT
Author: jwross
Date: Fri Mar  1 23:45:33 2013
New Revision: 1451781

URL: http://svn.apache.org/r1451781
Log:
[ARIES-1019] JPA weaving hook must be called before proxy weaving hook.

Register with the highest possible service ranking to avoid ClassNotFoundException caused
by interfaces added by earlier
weaving hooks that are not yet visible to the bundle class loader.

Modified:
    aries/trunk/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/weaving/impl/TransformerRegistryFactory.java

Modified: aries/trunk/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/weaving/impl/TransformerRegistryFactory.java
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/weaving/impl/TransformerRegistryFactory.java?rev=1451781&r1=1451780&r2=1451781&view=diff
==============================================================================
--- aries/trunk/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/weaving/impl/TransformerRegistryFactory.java
(original)
+++ aries/trunk/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/weaving/impl/TransformerRegistryFactory.java
Fri Mar  1 23:45:33 2013
@@ -18,7 +18,11 @@
  */
 package org.apache.aries.jpa.container.weaving.impl;
 
+import java.util.Dictionary;
+import java.util.Hashtable;
+
 import org.osgi.framework.Bundle;
+import org.osgi.framework.Constants;
 import org.osgi.framework.FrameworkUtil;
 
 /**
@@ -34,9 +38,15 @@ public class TransformerRegistryFactory 
     try {
       tr = (TransformerRegistry) Class.forName("org.apache.aries.jpa.container.weaving.impl.JPAWeavingHook").newInstance();
       Bundle b = FrameworkUtil.getBundle(tr.getClass());
-      if(b != null && (b.getState() & mask) != 0)
+      if(b != null && (b.getState() & mask) != 0) {
+        // ARIES-1019: Register with the highest possible service ranking to
+        // avoid ClassNotFoundException caused by interfaces added by earlier
+        // weaving hooks that are not yet visible to the bundle class loader.
+        Dictionary<String, Object> props = new Hashtable<String, Object>(1);
+        props.put(Constants.SERVICE_RANKING, Integer.MAX_VALUE);
         b.getBundleContext().registerService(
-            "org.osgi.framework.hooks.weaving.WeavingHook", tr, null);
+            "org.osgi.framework.hooks.weaving.WeavingHook", tr, props);
+      }
     } catch (NoClassDefFoundError ncdfe) {
       //TODO log this
     } catch (Exception e) {



Mime
View raw message