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..
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)
Both the interfaces extend org.w3c.dom.Element and somehow Spring in picking up the one from axiom-dom.jar
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 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)