Java SpringWebServiceTemplateJAR与Axis2冲突问题

Java SpringWebServiceTemplateJAR与Axis2冲突问题,java,spring,classpath,axis2,spring-ws,Java,Spring,Classpath,Axis2,Spring Ws,我在我的应用程序中使用SpringWeb服务和Axis2。它们是完全独立的,工作非常好,除了SpringWebServiceTemplate开始抛出下面的异常 我怀疑这是因为Spring需要saaj.jar(包含javax.xml.soap.SOAPElement),Axis2需要axiom-dom.jar(包含org.apache.axiom.om.impl.dom.ElementImpl) 这两个接口都扩展了org.w3c.dom.Element,并以某种方式从axiom-dom.jar中获

我在我的应用程序中使用SpringWeb服务和Axis2。它们是完全独立的,工作非常好,除了SpringWebServiceTemplate开始抛出下面的异常

我怀疑这是因为Spring需要saaj.jar(包含javax.xml.soap.SOAPElement),Axis2需要axiom-dom.jar(包含org.apache.axiom.om.impl.dom.ElementImpl)

这两个接口都扩展了org.w3c.dom.Element,并以某种方式从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.HandlerRequest(AbstractWsSecurityInterceptor.java:179) 位于org.springframework.ws.client.core.WebServiceTemplate.dosendReceive(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.MarshallSendAndReceive(WebServiceTemplate.java:341)

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

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

请参阅可能的相关问题:。这可能是saaj.jar的问题。请参阅相关问题:。这可能是saaj.jar的问题。