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/06/15 22:19:45 UTC

svn commit: r414671 - in /incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/xbean: AbstractXBeanDeployer.java ClassLoaderXmlPreprocessor.java

Author: gnodet
Date: Thu Jun 15 13:19:45 2006
New Revision: 414671

URL: http://svn.apache.org/viewvc?rev=414671&view=rev
Log:
Use xbean ClassLoaderXmlPreprocessor.java implementation and fix possible bad thread local context

Removed:
    incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/xbean/ClassLoaderXmlPreprocessor.java
Modified:
    incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/xbean/AbstractXBeanDeployer.java

Modified: incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/xbean/AbstractXBeanDeployer.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/xbean/AbstractXBeanDeployer.java?rev=414671&r1=414670&r2=414671&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/xbean/AbstractXBeanDeployer.java (original)
+++ incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/xbean/AbstractXBeanDeployer.java Thu Jun 15 13:19:45 2006
@@ -32,6 +32,7 @@
 import org.apache.xbean.kernel.KernelFactory;
 import org.apache.xbean.kernel.ServiceName;
 import org.apache.xbean.server.repository.FileSystemRepository;
+import org.apache.xbean.server.spring.configuration.ClassLoaderXmlPreprocessor;
 import org.apache.xbean.server.spring.loader.SpringLoader;
 
 public class AbstractXBeanDeployer extends AbstractDeployer {
@@ -109,12 +110,17 @@
             }
             return su;
         } catch (Exception e) {
+            // There is a chance the thread context classloader has been changed by the xbean kernel,
+            // so put back a good one
+            Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
             kernel.destroy();
             if (e instanceof DeploymentException) {
                 throw ((DeploymentException) e);
             } else {
                 throw failure("deploy", "Could not deploy xbean service unit", e);
             }
+        } finally {
+            Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
         }
     }