Or even return null to both methods so that PRovider.DEFAULT_JAXWSPROVIDER is used !
-----Romain WILBERT/FR/AKKA a écrit : ----- A : Florian Müller <[email protected]> De : Romain WILBERT/FR/AKKA Date : 17/01/2011 12:38 cc: [email protected] Objet : Re: [OpenCMIS] Incompatibility with CXF Maybe somthing like this would do the trick : ClassLoader cl = new URLClassLoader(new URL[0], Thread.currentThread().getContextClassLoader()) { public InputStream getResourceAsStream(String s) { if ("META-INF/services/javax.xml.ws.spi.Provider".equals("s")) { //return IS to com.sun.xml.ws.spi.ProviderImpl } return super.getResourceAsStream(s); } public URL getResource(String s) { if ("META-INF/services/javax.xml.ws.spi.Provider".equals("s")) { //return URL to com.sun.xml.ws.spi.ProviderImpl } return super.getResource(s); } }; //replace classloader Thread.currentThread().setContextClassLoader(cl); // initialize openCMIS Services [...] //restore default classloader Thread.currentThread().setContextClassLoader(cl.getParent()); Romain WILBERT Ingénieur développement AKKA Informatique & Systèmes -----Florian Müller <[email protected]> a écrit : ----- A : [email protected], [email protected] De : Florian Müller <[email protected]> Date : 17/01/2011 11:48 Objet : Re: [OpenCMIS] Incompatibility with CXF Hi Romain, It is possible to force the use of com.sun.xml.ws.spi.ProviderImpl by setting this system property: javax.xml.ws.spi.Provider = com.sun.xml.ws.spi.ProviderImpl But that would probably interfere with your CXF Web Services. It's not possible to use both with the same class loader. I'll try to add some class loader magic to OpenCMIS, but I can't promise that this will work eventually. - Florian On 14/01/2011 16:27, [email protected] wrote: > Hi ! > > Same problem as Erwan (apache CXF cohabitation...) => > (http://mail-archives.apache.org/mod_mbox/incubator-chemistry-dev/201101.mbox/browser) > > Since my project exposes CXF WebServices, I have an error while initializing > OpenCMIS WebService client : > > org.apache.chemistry.opencmis.commons.exceptions.CmisConnectionException: > Cannot initalize Web Services port object: $Proxy340 cannot be cast to > com.sun.xml.ws.developer.WSBindingProvider > at > org.apache.chemistry.opencmis.client.bindings.spi.webservices.PortProvider.createPortObject(PortProvider.java:325) > > This happens because the first found provider on classloader is > org.apache.cxf.jaxws22.spi.ProviderImpl (cxf-rt-frontend-jaxws.jar precedes > jaxws-rt in classloader). My Proxy is a > org.apache.cxf.jaxws.JaxWsClientProxy, which causes the ClassCastException. > > > Any workaround for this ? Why don't you force the use of > com.sun.xml.ws.spi.ProviderImpl from jaxws-rt as it is anyway a Maven > dependency of opencmis-client ? > > Thanks. > > Romain WILBERT > Ingénieur développement > AKKA Informatique& Systèmes > >
