gpt4 book ai didi

java - Spring webservicetemplate jar 与 Axis2 冲突问题

转载 作者:行者123 更新时间:2023-12-02 00:10:23 25 4
gpt4 key购买 nike

我在我的应用程序中使用 Spring Web 服务和 Axis2。它们是完全独立的,并且工作得很好,除了 Spring WebServiceTemplate 开始抛出下面的异常..

我怀疑发生这种情况是因为 Spring 需要 saaj.jar(其中包含 javax.xml.soap.SOAPElement)而 Axis2 需要 axiom-dom.jar(其中包含 org.apache.axiom.om.impl.dom.ElementImpl)

这两个接口(interface)都扩展了 org.w3c.dom.Element 并且以某种方式 Spring 从 axiom-dom.jar 中获取了一个

除了将 axiom-dom.jar 重命名为 z-axiom-dom.jar 以外,我还能做些什么来防止 Spring 在运行时获取错误的实现,以便其稍后出现在类路径中?

com.sun.xml.wss.XWSSecurityException:com.sun.xml.wss.XWSSecurityException:java.lang.ClassCastException:org.apache.axiom.om.impl.dom.ElementImpl 无法转换为 javax .xml.soap.SOAPElement 在 org.springframework.ws.soap.security.xwss.XwsSecurityInterceptor.secureMessage(XwsSecurityInterceptor.java:139) 在org.springframework.ws.soap.security.AbstractWsSecurityInterceptor.handleRequest(AbstractWsSecurityInterceptor.java:179) 在 org.springframework.ws.client.core.WebServiceTemplate.doSendAndReceive(WebServiceTemplate.java:542) 在 org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:502) 在 org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:351) 在 org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:341)

最佳答案

这不是saaj和axiom-dom之间的冲突,而是saaj和axis2-saaj.jar之间的冲突。 axis2-saaj 使用 axiom-dom,这就是异常引用 Axiom 的原因。如果您不使用 Axis2 提供的 JAX-WS 实现,那么您不需要 axis2-saaj,因此根据您的用例,删除它可能是一个解决方案。

关于java - Spring webservicetemplate jar 与 Axis2 冲突问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12944811/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com