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 2006/04/12 20:54:57 UTC

svn commit: r393577 - /incubator/servicemix/trunk/servicemix-jsr181/src/main/java/org/apache/servicemix/jsr181/Jsr181XBeanDeployer.java

Author: gnodet
Date: Wed Apr 12 11:54:44 2006
New Revision: 393577

URL: http://svn.apache.org/viewcvs?rev=393577&view=rev
Log:
SM-396: classloading issue in servicemix-jsr181 - thread context classloader not set to serviceunit classloader
Patch provided by Renaud Bruyeron

Modified:
    incubator/servicemix/trunk/servicemix-jsr181/src/main/java/org/apache/servicemix/jsr181/Jsr181XBeanDeployer.java

Modified: incubator/servicemix/trunk/servicemix-jsr181/src/main/java/org/apache/servicemix/jsr181/Jsr181XBeanDeployer.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-jsr181/src/main/java/org/apache/servicemix/jsr181/Jsr181XBeanDeployer.java?rev=393577&r1=393576&r2=393577&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-jsr181/src/main/java/org/apache/servicemix/jsr181/Jsr181XBeanDeployer.java (original)
+++ incubator/servicemix/trunk/servicemix-jsr181/src/main/java/org/apache/servicemix/jsr181/Jsr181XBeanDeployer.java Wed Apr 12 11:54:44 2006
@@ -15,11 +15,12 @@
  */
 package org.apache.servicemix.jsr181;
 
+import javax.jbi.management.DeploymentException;
+
 import org.apache.servicemix.common.BaseComponent;
 import org.apache.servicemix.common.Endpoint;
 import org.apache.servicemix.common.xbean.AbstractXBeanDeployer;
-
-import javax.jbi.management.DeploymentException;
+import org.apache.servicemix.common.xbean.XBeanServiceUnit;
 
 public class Jsr181XBeanDeployer extends AbstractXBeanDeployer {
 
@@ -35,10 +36,14 @@
         if (ep.getPojo() == null && ep.getPojoClass() == null) {
             throw failure("deploy", "Endpoint must have a non-null pojo or a pojoClass", null);
         }
+        ClassLoader old = Thread.currentThread().getContextClassLoader();
         try {
+            Thread.currentThread().setContextClassLoader(((XBeanServiceUnit)ep.getServiceUnit()).getConfigurationClassLoader());
             ep.registerService();
         } catch (Exception e) {
             throw failure("deploy", "Could not register endpoint", e);
+        } finally {
+            Thread.currentThread().setContextClassLoader(old);
         }
         return true;
     }