本文主要是介绍随手记(1)-cxf和xercesImpl.jar冲突,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
JaxWsDynamicClientFactory clientFactory = JaxWsDynamicClientFactory.newInstance();
Client client = clientFactory.createClient(url);
result = client.invoke("methodName", condition);
在使用CXF框架调用远端服务器方法是报错如下
java.lang.AbstractMethodError: org.apache.xerces.dom.ElementNSImpl.setUserData(Ljava/lang/String;Ljava/lang/Object;Lorg/w3c/dom/UserDataHandler;)Ljava/lang/Object; at org.apache.cxf.staxutils.StaxUtils.addLocation(StaxUtils.java:1038) at org.apache.cxf.staxutils.StaxUtils.startElement(StaxUtils.java:893) at org.apache.cxf.staxutils.StaxUtils.readDocElements(StaxUtils.java:965) at org.apache.cxf.staxutils.StaxUtils.read(StaxUtils.java:848) at org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:219) at org.apache.cxf.wsdl11.WSDLManagerImpl.getDefinition(WSDLManagerImpl.java:161) at org.apache.cxf.wsdl11.WSDLServiceFactory.(WSDLServiceFactory.java:67) at org.apache.cxf.endpoint.ClientImpl.(ClientImpl.java:152) at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:255) at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:198) at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:191) at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:146)
问题原因:
CXF 和xercesImpl.jar有冲突才报的错
解决方法:
1、如果xercesImpl.jar没有在程序中引用则可以直接删除xercesImpl.jar,
2、把xercesImpl.jar替换成xercesImpl-2_9_1.jar即可
xercesImpl-2_9_1.jar下载
这篇关于随手记(1)-cxf和xercesImpl.jar冲突的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!