You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by ff...@apache.org on 2009/02/24 05:19:59 UTC

svn commit: r747272 - /servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/ComponentInstaller.java

Author: ffang
Date: Tue Feb 24 04:19:59 2009
New Revision: 747272

URL: http://svn.apache.org/viewvc?rev=747272&view=rev
Log:
[SMX4KNL-209]ComponentInstaller.createBootstrap() should add component's SharedLib when create MultipleParentClassLoader

Modified:
    servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/ComponentInstaller.java

Modified: servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/ComponentInstaller.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/ComponentInstaller.java?rev=747272&r1=747271&r2=747272&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/ComponentInstaller.java (original)
+++ servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/ComponentInstaller.java Tue Feb 24 04:19:59 2009
@@ -320,12 +320,24 @@
         ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
         ComponentDesc descriptor = installationContext.getDescriptor();
         try {
+            List<SharedLibrary> libs = new ArrayList<SharedLibrary>();
+            if (descriptor.getSharedLibraries() != null) {
+                for (SharedLibraryList sll : descriptor.getSharedLibraries()) {
+                    SharedLibrary lib = deployer.getSharedLibrary(sll.getName());
+                    if (lib == null) {
+                        // TODO: throw exception here ?
+                    } else {
+                        libs.add(lib);
+                    }
+                }
+            }
+            SharedLibrary[] aLibs = libs.toArray(new SharedLibrary[libs.size()]);
             ClassLoader cl = createClassLoader(
                     getBundle(),
                     installationContext.getInstallRoot(),
                     descriptor.getBootstrapClassPath().getPathElements(),
                     descriptor.isBootstrapClassLoaderDelegationParentFirst(),
-                    null);
+                    aLibs);
             Thread.currentThread().setContextClassLoader(cl);
             Class bootstrapClass = cl.loadClass(descriptor.getBootstrapClassName());
             return (Bootstrap) bootstrapClass.newInstance();



Re: svn commit: r747272 - /servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/ComponentInstaller.java

Posted by Guillaume Nodet <gn...@gmail.com>.
I don't think this is a good idea to do that.  See section 7.3 of the
JBI specs: the boostrap classloader should not include the shared
libraries:

  "The execution class loader adds one more item to be supported:
shared libraries, which are described in section 7.3.2, below."

Could you please revert the commit and close the bug with "Work as  designed" ?

On Tue, Feb 24, 2009 at 05:19,  <ff...@apache.org> wrote:
> Author: ffang
> Date: Tue Feb 24 04:19:59 2009
> New Revision: 747272
>
> URL: http://svn.apache.org/viewvc?rev=747272&view=rev
> Log:
> [SMX4KNL-209]ComponentInstaller.createBootstrap() should add component's SharedLib when create MultipleParentClassLoader
>
> Modified:
>    servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/ComponentInstaller.java
>
> Modified: servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/ComponentInstaller.java
> URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/ComponentInstaller.java?rev=747272&r1=747271&r2=747272&view=diff
> ==============================================================================
> --- servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/ComponentInstaller.java (original)
> +++ servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/ComponentInstaller.java Tue Feb 24 04:19:59 2009
> @@ -320,12 +320,24 @@
>         ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
>         ComponentDesc descriptor = installationContext.getDescriptor();
>         try {
> +            List<SharedLibrary> libs = new ArrayList<SharedLibrary>();
> +            if (descriptor.getSharedLibraries() != null) {
> +                for (SharedLibraryList sll : descriptor.getSharedLibraries()) {
> +                    SharedLibrary lib = deployer.getSharedLibrary(sll.getName());
> +                    if (lib == null) {
> +                        // TODO: throw exception here ?
> +                    } else {
> +                        libs.add(lib);
> +                    }
> +                }
> +            }
> +            SharedLibrary[] aLibs = libs.toArray(new SharedLibrary[libs.size()]);
>             ClassLoader cl = createClassLoader(
>                     getBundle(),
>                     installationContext.getInstallRoot(),
>                     descriptor.getBootstrapClassPath().getPathElements(),
>                     descriptor.isBootstrapClassLoaderDelegationParentFirst(),
> -                    null);
> +                    aLibs);
>             Thread.currentThread().setContextClassLoader(cl);
>             Class bootstrapClass = cl.loadClass(descriptor.getBootstrapClassName());
>             return (Bootstrap) bootstrapClass.newInstance();
>
>
>



-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://fusesource.com