Author: alessio.soldano(a)jboss.com
Date: 2011-03-01 17:06:28 -0500 (Tue, 01 Mar 2011)
New Revision: 13828
Modified:
stack/cxf/branches/JBWS-3236/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/ProviderImpl.java
stack/cxf/branches/JBWS-3236/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/configuration/JBossWSNonSpringBusFactory.java
Log:
Providing proper classloader to be used for loading apache cxf bus extensions and fixing
comments accordingly
Modified:
stack/cxf/branches/JBWS-3236/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/ProviderImpl.java
===================================================================
---
stack/cxf/branches/JBWS-3236/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/ProviderImpl.java 2011-03-01
22:03:09 UTC (rev 13827)
+++
stack/cxf/branches/JBWS-3236/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/ProviderImpl.java 2011-03-01
22:06:28 UTC (rev 13828)
@@ -185,9 +185,11 @@
catch (Exception e)
{
//[JBWS-3223] On AS7 the TCCL that's set for basic (non-ws-endpoint)
servlet/ejb3
- //apps doesn't have visibility on any WS implementation class, so Apache
CXF
- //can't load its components through it - we need to change the TCCL using
- //the classloader that has been used to load this javax.xml.ws.spi.Provider
impl.
+ //apps doesn't have visibility on any WS implementation class, nor on any
class
+ //coming from dependencies provided in the ws modules only. This means for
instance
+ //the JAXBContext is not going to find a context impl, etc.
+ //In general, we need to change the TCCL using the classloader that has been
used
+ //to load this javax.xml.ws.spi.Provider impl, which is the jaxws-client
module.
ClassLoader clientClassLoader = ProviderImpl.class.getClassLoader();
//first ensure the default bus is loaded through the client classloader only
@@ -197,7 +199,7 @@
JBossWSBusFactory.getDefaultBus(clientClassLoader);
}
//then setup a new TCCL having visibility over both the client path (JBossWS
- //client module on AS7) and the the former TCCL (i.e. the deployment
classloader)
+ //jaxws-client module on AS7) and the the former TCCL (i.e. the deployment
classloader)
setContextClassLoader(new DelegateClassLoader(clientClassLoader,
origClassLoader));
return true;
}
Modified:
stack/cxf/branches/JBWS-3236/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/configuration/JBossWSNonSpringBusFactory.java
===================================================================
---
stack/cxf/branches/JBWS-3236/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/configuration/JBossWSNonSpringBusFactory.java 2011-03-01
22:03:09 UTC (rev 13827)
+++
stack/cxf/branches/JBWS-3236/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/configuration/JBossWSNonSpringBusFactory.java 2011-03-01
22:06:28 UTC (rev 13828)
@@ -21,6 +21,7 @@
*/
package org.jboss.wsf.stack.cxf.client.configuration;
+import java.lang.ref.WeakReference;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedList;
@@ -54,6 +55,7 @@
import org.apache.cxf.ws.rm.RMManager;
import org.apache.cxf.ws.rm.policy.RMAssertionBuilder;
import org.apache.cxf.ws.rm.policy.RMPolicyInterceptorProvider;
+import org.jboss.wsf.stack.cxf.client.ProviderImpl;
/**
*
@@ -77,7 +79,10 @@
preparePolicyEngine(extensions);
- Bus bus = new ExtensionManagerBus(extensions, properties);
+ //Explicitly ask for the ProviderImpl.class.getClassLoader() to be used for
getting
+ //cxf bus extensions (as that classloader is the jaxws-client module one which
'sees' all
+ //extensions, unless different dependencies are explicitly set)
+ Bus bus = new ExtensionManagerBus(extensions, properties,
ProviderImpl.class.getClassLoader());
initPolicyEngine((PolicyEngineImpl)extensions.get(PolicyEngine.class), bus);