static boolean checkAndFixContextClassLoader ( ClassLoader origClassLoader ) { try { origClassLoader . loadClass ( ProviderImpl . class . getName ( ) ) ; } 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, 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 //(no deployment classloader contribution) if ( BusFactory . getDefaultBus ( false ) == null ) { JBossWSBusFactory . getDefaultBus ( clientClassLoader ) ; } //then setup a new TCCL having visibility over both the client path (JBossWS //jaxws-client module on AS7) and the the former TCCL (i.e. the deployment classloader) setContextClassLoader ( createDelegateClassLoader ( clientClassLoader , origClassLoader ) ) ; return true ; } return false ; }
Ensure the current context classloader can load this ProviderImpl class .