在Javax.xml.ws服务上添加XMLParserV2 jar时发生冲突

时间:2015-04-30 09:42:16

标签: java xml web-services xml-parsing

当我在项目中添加jar XMlparverv2时,我得到以下例外情况:

org.apache.cxf.interceptor.Fault: Unable to create envelope from given source: 
    at org.apache.cxf.jaxws.interceptors.MessageModeOutInterceptor$MessageModeOutInterceptorInternal.handleMessage(MessageModeOutInterceptor.java:243)
    at org.apache.cxf.jaxws.interceptors.MessageModeOutInterceptor$MessageModeOutInterceptorInternal.handleMessage(MessageModeOutInterceptor.java:182)
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:255)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:544)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:341)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:294)
    at org.apache.cxf.endpoint.ClientImpl.invokeWrapped(ClientImpl.java:329)
    at org.apache.cxf.jaxws.DispatchImpl.invoke(DispatchImpl.java:346)
    at org.apache.cxf.jaxws.DispatchImpl.invoke(DispatchImpl.java:220)
    at com.test.comp.CallWebservice.DispatchService(CallWebservice.java:64)
    at com.test.comp.CallWebservice.main(CallWebservice.java:135)
Caused by: com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Unable to create envelope from given source: 
    at com.sun.xml.internal.messaging.saaj.soap.EnvelopeFactory.createEnvelope(Unknown Source)
    at com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPPart1_1Impl.createEnvelopeFromSource(Unknown Source)
    at com.sun.xml.internal.messaging.saaj.soap.SOAPPartImpl.getEnvelope(Unknown Source)
    at com.sun.xml.internal.messaging.saaj.soap.MessageImpl.getSOAPBody(Unknown Source)
    at org.apache.cxf.jaxws.interceptors.MessageModeOutInterceptor$MessageModeOutInterceptorInternal.handleMessage(MessageModeOutInterceptor.java:227)
    ... 10 more
Caused by: javax.xml.transform.TransformerException: XML-22103: (Fatal Error) DOMResult can not be this kind of node.
    at oracle.xml.jaxp.JXTransformer.reportException(JXTransformer.java:812)
    at oracle.xml.jaxp.JXTransformer.transform(JXTransformer.java:298)
    at com.sun.xml.internal.messaging.saaj.util.transform.EfficientStreamingTransformer.transform(Unknown Source)
    ... 15 more

但是没有XMLparserV2 jar,我的代码运行没有任何问题。我怀疑两个解析器之间存在冲突。我还需要XMLParserv2来将oracle XMLtype转换为字符串。

你能帮助别人帮忙解决这个问题吗?

1 个答案:

答案 0 :(得分:1)

JAR文件包含一个META-INF \ services目录,其中包含将覆盖服务器使用的XML处理器的文件。

来自Java SE javadoc

  

使用Services API(如JAR规范中详述)(如果可用)来确定类名。 Services API将在运行时可用的jar文件中的META-INF / services / javax.xml.parsers.SAXParserFactory文件中查找类名。

我使用7-zip从META-INF \ services中删除文件并使用该JAR代替。我的XML对象解析现在可以正常工作,其他一切都不受影响。

enter image description here