0

卡拉夫 2.3.2

据我所知,我的代码或容器配置中没有对 Apache cxf 的引用,但是当我尝试使用 Exchange Web 服务时,由于我没有安装 cxf,所以 cxf 接管了 jax 实现,给出了这个错误:

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

我已经创建了包含 com.sun.xml.internal.ws.spi.ProviderImpl 内容的 META-INF\services\javax.xml.ws.spi.Provider 文件,但是在 Karaf 中这似乎没有注册。

尽管没有引用 cxf,但为什么它试图加载 cxf 有什么想法吗?还是有另一种强制使用默认实现的方法?

非常感谢

对于 ref,provider.provide() 方法似乎正在尝试加载 cxf 实现

/** 
 * 
 * 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); 
    } 
} 
4

2 回答 2

0

事实证明,Karaf 包含 FactoryFinder.java 的实现,它在 lib/endorsed 文件夹中查找 cxf 实现。我刚刚删除了这个文件夹。

于 2014-06-04T14:14:51.497 回答
0

首先,您不应该安装 CXF 包,其次,您需要将“com.sun.xml.internal.ws.spi”包暴露给系统包。

于 2014-03-28T12:25:07.657 回答