You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2008/11/20 08:58:53 UTC

svn commit: r719191 - /servicemix/components/shared-libraries/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/xbean/ClassLoaderXmlPreprocessor.java

Author: gnodet
Date: Wed Nov 19 23:58:53 2008
New Revision: 719191

URL: http://svn.apache.org/viewvc?rev=719191&view=rev
Log:
SM-1662: When deployed in Smx4, the JBI SUs do not have access to the whole JRE

Modified:
    servicemix/components/shared-libraries/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/xbean/ClassLoaderXmlPreprocessor.java

Modified: servicemix/components/shared-libraries/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/xbean/ClassLoaderXmlPreprocessor.java
URL: http://svn.apache.org/viewvc/servicemix/components/shared-libraries/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/xbean/ClassLoaderXmlPreprocessor.java?rev=719191&r1=719190&r2=719191&view=diff
==============================================================================
--- servicemix/components/shared-libraries/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/xbean/ClassLoaderXmlPreprocessor.java (original)
+++ servicemix/components/shared-libraries/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/xbean/ClassLoaderXmlPreprocessor.java Wed Nov 19 23:58:53 2008
@@ -84,8 +84,16 @@
             } else {
                 try {
                     URL[] urls = getDefaultLocations();
-                    ClassLoader parentLoader = getParentClassLoader(applicationContext);
-                    classLoader = new JarFileClassLoader(applicationContext.getDisplayName(), urls, parentLoader);
+                    List<ClassLoader> parents = new ArrayList<ClassLoader>();
+                    parents.add(getParentClassLoader(applicationContext));
+                    // In smx4, add the system classloader as a parent so that the whole JRE classes are available
+                    // to the SU, and not only the packages used by the components themselves
+                    if (component.getContainer().getType() == Container.Type.ServiceMix4) {
+                        parents.add(ClassLoader.getSystemClassLoader());
+                    }
+                    classLoader = new JarFileClassLoader(applicationContext.getDisplayName(),
+                                                         urls,
+                                                         parents.toArray(new ClassLoader[parents.size()]));
                     // assign the class loader to the xml reader and the
                     // application context
                 } catch (Exception e) {