Spring WebServiceTemplate Jar与Axis2的冲突问题 [英] Spring webservicetemplate jar conflict issue with Axis2

查看:187
本文介绍了Spring WebServiceTemplate Jar与Axis2的冲突问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用程序中都使用了Spring Web服务和Axis2.它们是完全独立的,并且运行良好,只是Spring WebServiceTemplate开始在下面引发异常.

I use Spring web services and Axis2 both in my app. They are completely independent and it works great, except that Spring WebServiceTemplate started throwing the exception below..

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

I suspect it's happening because Spring requires saaj.jar (which has javax.xml.soap.SOAPElement) and Axis2 requires axiom-dom.jar (which has org.apache.axiom.om.impl.dom.ElementImpl)

这两个接口都扩展了org.w3c.dom.Element并通过某种方式让Spring从axiom-dom.jar中获取了一个

Both the interfaces extend org.w3c.dom.Element and somehow Spring in picking up the one from axiom-dom.jar

除了防止将axiom-dom.jar重命名为z-axiom-dom.jar之外,其他任何有关防止Spring在运行时获取错误实现的想法,

Any ideas as to what i can do to prevent Spring from picking up the wrong implementation at runtime other than perhaps renaming axiom-dom.jar to z-axiom-dom.jar, so its later in the classpath?

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)

com.sun.xml.wss.XWSSecurityException: com.sun.xml.wss.XWSSecurityException: java.lang.ClassCastException: org.apache.axiom.om.impl.dom.ElementImpl cannot be cast to javax.xml.soap.SOAPElement at org.springframework.ws.soap.security.xwss.XwsSecurityInterceptor.secureMessage(XwsSecurityInterceptor.java:139) at org.springframework.ws.soap.security.AbstractWsSecurityInterceptor.handleRequest(AbstractWsSecurityInterceptor.java:179) at org.springframework.ws.client.core.WebServiceTemplate.doSendAndReceive(WebServiceTemplate.java:542) at org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:502) at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:351) at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:341)

推荐答案

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

This is not a conflict between saaj and axiom-dom, but a conflict between saaj and axis2-saaj.jar. axis2-saaj uses axiom-dom which is why the exception refers to Axiom. If you don't use the JAX-WS implementation provided by Axis2, then you don't need axis2-saaj, so depending on your use case, removing it may be a solution.

这篇关于Spring WebServiceTemplate Jar与Axis2的冲突问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆