Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Multiple Jars Issue: SoapHeader.addHeaderElement(Name) Vs SoapHeader.addHeaderElement(Name)  RSS feed

Samuel Jason
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I am working on a spring-ws client to invoke a webservice using binary security token. I have all the code set-up and everything seems to be working fine except for one issue.

This spring-ws client will be deployed as part of an EAR on weblogic server. There are several third part jar files in the classpath including axis jars.

Now following line is my code is causing troubles :

where ctxElement is of type JAXBElement and header is of type javax.xml.soap.SOAPHeader;

Error: addHeaderElement(javax.xml.soap.Name) in javax.xml.soap.SOAPHeader cannot be applied to (javax.xml.namespace.QName)

I did some analysis and figured out the issue - javax.xml.soap.SOAPHeader class is available in both axis/saaj.jar and spring/jaxb-api2.1jar.
The version present in axis/saaj.jar only has following method

The version present in spring/jaxb-api2.1jar only has both the following methods

Now do I solve this issue -

Should I just make sure spring/jaxb-api2.1jar appears before axis/saaj.jar in the classpath. Is that the correct way to address this issue in a production environment.
What are the alternate solutions?

Please help

With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!