diff options
Diffstat (limited to '')
-rw-r--r-- | java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceClient.java | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceClient.java b/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceClient.java index d2ba46a7e2..09e64b836c 100644 --- a/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceClient.java +++ b/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceClient.java @@ -126,7 +126,12 @@ public class Axis2ServiceClient { * Create an Axis2 ServiceClient */ protected ServiceClient createServiceClient() { - try { + ClassLoader tccl = Thread.currentThread().getContextClassLoader(); + ClassLoader axiscl = this.getClass().getClassLoader(); + + try { + if( axiscl != tccl ) Thread.currentThread().setContextClassLoader(axiscl); + final boolean isRampartRequired = AxisPolicyHelper.isRampartRequired(wsBinding); ConfigurationContext configContext; @@ -145,7 +150,7 @@ public class Axis2ServiceClient { // configureSecurity(); } catch (PrivilegedActionException e) { throw new ServiceRuntimeException(e.getException()); - } + } // end try createPolicyHandlers(); @@ -171,7 +176,7 @@ public class Axis2ServiceClient { } } } - } + } // end if AxisService axisService = createClientSideAxisService(definition, serviceQName, port.getName(), new Options()); @@ -188,7 +193,7 @@ public class Axis2ServiceClient { configContext.setThreadPool(new ThreadPool(1, 5)); configContext.setProperty(HTTPConstants.REUSE_HTTP_CLIENT, Boolean.TRUE); configContext.setProperty(HTTPConstants.CACHED_HTTP_CLIENT, httpClient); - } + } // end if return new ServiceClient(configContext, axisService); @@ -200,8 +205,11 @@ public class Axis2ServiceClient { throw new RuntimeException(e); } catch (IllegalAccessException e) { throw new RuntimeException(e); - } - } + } finally { + // Restore the Thread Context ClassLoader... + if( axiscl != tccl ) Thread.currentThread().setContextClassLoader(tccl); + } // end try + } // end method createServiceClient /** * URI resolver implementation for XML schema |