You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by cu...@apache.org on 2009/09/15 20:56:56 UTC

svn commit: r815447 - /openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ProductDerivations.java

Author: curtisr7
Date: Tue Sep 15 18:56:55 2009
New Revision: 815447

URL: http://svn.apache.org/viewvc?rev=815447&view=rev
Log:
OPENJPA-1302: Use ContextClassloader in addition to the ProductDeivation's ClassLoader to find/load product derivations. Patch contributed by Rick Curtis.

Modified:
    openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ProductDerivations.java

Modified: openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ProductDerivations.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ProductDerivations.java?rev=815447&r1=815446&r2=815447&view=diff
==============================================================================
--- openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ProductDerivations.java (original)
+++ openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ProductDerivations.java Tue Sep 15 18:56:55 2009
@@ -36,6 +36,7 @@
 import org.apache.openjpa.lib.util.J2DoPrivHelper;
 import org.apache.openjpa.lib.util.JavaVersions;
 import org.apache.openjpa.lib.util.Localizer;
+import org.apache.openjpa.lib.util.MultiClassLoader;
 import org.apache.openjpa.lib.util.Services;
 
 /**
@@ -55,8 +56,10 @@
     private static final Throwable[] _derivationErrors;
     private static String[] _prefixes;
     static {
-        ClassLoader l = AccessController.doPrivileged(
-            J2DoPrivHelper.getClassLoaderAction(ProductDerivation.class)); 
+        MultiClassLoader l = AccessController.doPrivileged(J2DoPrivHelper.newMultiClassLoaderAction());
+        l.addClassLoader(0, AccessController
+            .doPrivileged(J2DoPrivHelper.getClassLoaderAction(ProductDerivations.class)));
+        l.addClassLoader(1, AccessController.doPrivileged(J2DoPrivHelper.getContextClassLoaderAction()));
         _derivationNames = Services.getImplementors(ProductDerivation.class, l);
         _derivationErrors = new Throwable[_derivationNames.length];
         List<ProductDerivation> derivations =