karaf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fredle <fred...@matterhorninvestment.com>
Subject How do I stop cxf taking over the default implementation of javax.xml.ws.spi.Provider?
Date Wed, 26 Mar 2014 10:50:57 GMT
Hi,

Karaf 2.3.2

As far as I am aware, I have no references to Apache cxf in my code or
container configuration, however when I try to consume Exchange webservices,
the jax implementation is being taken over by cxf giving this error as I
don't have cxf installed:

./data/karaf.out:javax.xml.ws.spi.FactoryFinder$ConfigurationError: Provider
org.apache.cxf.jaxws.spi.ProviderImpl not found

I have created the file META-INF\services\javax.xml.ws.spi.Provider with the
contents com.sun.xml.internal.ws.spi.ProviderImpl, however in Karaf this
doesn't appear to register.

Any thoughts as to why it is trying to load cxf despite no references to
cxf? Or is there another way to force the use of the default implementation?

Many thanks


For ref, the provider.provide() method which appears to be attempting to
load the csf implementation
    /**
     *
     * Creates a new provider object.
     * <p>
     * The algorithm used to locate the provider subclass to use consists
     * of the following steps:
     * <p>
     * <ul>
     * <li>
     *   If a resource with the name of
     *   <code>META-INF/services/javax.xml.ws.spi.Provider</code>
     *   exists, then its first line, if present, is used as the UTF-8
encoded
     *   name of the implementation class.
     * </li>
     * <li>
     *   If the $java.home/lib/jaxws.properties file exists and it is
readable by
     *   the <code>java.util.Properties.load(InputStream)</code> method and
it contains
     *   an entry whose key is <code>javax.xml.ws.spi.Provider</code>, then
the value of
     *   that entry is used as the name of the implementation class.
     * </li>
     * <li>
     *   If a system property with the name
<code>javax.xml.ws.spi.Provider</code>
     *   is defined, then its value is used as the name of the
implementation class.
     * </li>
     * <li>
     *   Finally, a default implementation class name is used.
     * </li>
     * </ul>
     *
     */
    public static Provider provider() {
        try {
            Object provider = getProviderUsingServiceLoader();
            if (provider == null) {
                provider = FactoryFinder.find(JAXWSPROVIDER_PROPERTY,
DEFAULT_JAXWSPROVIDER);
            }
            if (!(provider instanceof Provider)) {
                Class pClass = Provider.class;
                String classnameAsResource = pClass.getName().replace('.',
'/') + ".class";
                ClassLoader loader = pClass.getClassLoader();
                if(loader == null) {
                    loader = ClassLoader.getSystemClassLoader();
                }
                URL targetTypeURL  =
loader.getResource(classnameAsResource);
                throw new LinkageError("ClassCastException: attempting to
cast" +
                      
provider.getClass().getClassLoader().getResource(classnameAsResource) +
                       "to" + targetTypeURL.toString() );
            }
            return (Provider) provider;
        } catch (WebServiceException ex) {
            throw ex;
        } catch (Exception ex) {
            throw new WebServiceException("Unable to createEndpointReference
Provider", ex);
        }
    }






--
View this message in context: http://karaf.922171.n3.nabble.com/How-do-I-stop-cxf-taking-over-the-default-implementation-of-javax-xml-ws-spi-Provider-tp4032414.html
Sent from the Karaf - Dev mailing list archive at Nabble.com.

Mime
View raw message