summaryrefslogtreecommitdiffstats
path: root/java/sca
diff options
context:
space:
mode:
Diffstat (limited to 'java/sca')
-rw-r--r--java/sca/modules/binding-ws-axis2/pom.xml4
-rw-r--r--java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceBindingProvider.java6
-rw-r--r--java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java29
3 files changed, 28 insertions, 11 deletions
diff --git a/java/sca/modules/binding-ws-axis2/pom.xml b/java/sca/modules/binding-ws-axis2/pom.xml
index 41d17ce0cf..8ab98ba2d7 100644
--- a/java/sca/modules/binding-ws-axis2/pom.xml
+++ b/java/sca/modules/binding-ws-axis2/pom.xml
@@ -178,6 +178,10 @@
<scope>runtime</scope>
<exclusions>
<exclusion>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-adb</artifactId>
+ </exclusion>
+ <exclusion>
<groupId>stax</groupId>
<artifactId>stax-api</artifactId>
</exclusion>
diff --git a/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceBindingProvider.java b/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceBindingProvider.java
index 8aa2181c22..a3277a39e3 100644
--- a/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceBindingProvider.java
+++ b/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceBindingProvider.java
@@ -18,6 +18,8 @@
*/
package org.apache.tuscany.sca.binding.ws.axis2;
+import javax.xml.stream.XMLInputFactory;
+
import org.apache.axiom.om.OMElement;
import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
import org.apache.tuscany.sca.core.FactoryExtensionPoint;
@@ -58,7 +60,9 @@ public class Axis2ServiceBindingProvider implements ServiceBindingProvider {
InterfaceContract contract = wsBinding.getBindingInterfaceContract();
contract.getInterface().resetDataBinding(OMElement.class.getName());
- axisProvider = new Axis2ServiceProvider(component, service, wsBinding, servletHost, messageFactory);
+ // Pass in the XMLInputFactory to work around the Axis2 way of loading XMLInputFactory
+ XMLInputFactory inputFactory = modelFactories.getFactory(XMLInputFactory.class);
+ axisProvider = new Axis2ServiceProvider(component, service, wsBinding, servletHost, messageFactory, inputFactory);
}
public void start() {
diff --git a/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java b/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java
index dd58b39a1c..e1ba92c3d4 100644
--- a/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java
+++ b/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java
@@ -43,6 +43,7 @@ import javax.wsdl.extensions.UnknownExtensibilityElement;
import javax.wsdl.extensions.soap.SOAPAddress;
import javax.wsdl.extensions.soap12.SOAP12Address;
import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
@@ -161,7 +162,8 @@ public class Axis2ServiceProvider {
AbstractContract contract,
WebServiceBinding wsBinding,
ServletHost servletHost,
- MessageFactory messageFactory) {
+ MessageFactory messageFactory,
+ final XMLInputFactory xmlInputFactory) {
this.component = component;
this.contract = contract;
@@ -174,20 +176,27 @@ public class Axis2ServiceProvider {
// TuscanyAxisConfigurator tuscanyAxisConfigurator = new TuscanyAxisConfigurator();
// Allow privileged access to read properties. Requires PropertyPermission read in
// security policy.
- TuscanyAxisConfigurator tuscanyAxisConfigurator =
- AccessController.doPrivileged(new PrivilegedExceptionAction<TuscanyAxisConfigurator>() {
- public TuscanyAxisConfigurator run() throws AxisFault {
- return new TuscanyAxisConfigurator(isRampartRequired);
+ configContext = AccessController.doPrivileged(new PrivilegedExceptionAction<ConfigurationContext>() {
+ public ConfigurationContext run() throws AxisFault {
+ ClassLoader newTccl = xmlInputFactory.getClass().getClassLoader();
+ ClassLoader tccl = Thread.currentThread().getContextClassLoader();
+ if (newTccl != null && newTccl != tccl) {
+ Thread.currentThread().setContextClassLoader(newTccl);
}
- });
- configContext = tuscanyAxisConfigurator.getConfigurationContext();
+ try {
+ return new TuscanyAxisConfigurator(isRampartRequired).getConfigurationContext();
+ } finally {
+ if (newTccl != null && newTccl != tccl) {
+ Thread.currentThread().setContextClassLoader(tccl);
+ }
+ }
+ }
+ });
// deployRampartModule();
// configureSecurity();
} catch (PrivilegedActionException e) {
throw new ServiceRuntimeException(e.getException());
- } catch (AxisFault e) {
- throw new ServiceRuntimeException(e); // TODO: better exception
- }
+ }
configContext.setContextRoot(servletHost.getContextPath());