ClassCastException for SecurityHeader

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

ClassCastException for SecurityHeader

csdave
This post has NOT been accepted by the mailing list yet.
Hi,

I have the same issue as here - https://java.net/projects/metro/lists/users/archive/2015-05/message/2

There was no answer to this question. I do not have control over the wsdl nor the web service I am exercising. Unfortunately it is a commercial paid for service. The same company has other wsdl's and I have successfully used wsimport to generate from these and they work. It is only this one that is not working.

Exception in thread "main" javax.xml.ws.WebServiceException: java.lang.ClassCastException: com.sun.xml.ws.message.jaxb.JAXBHeader cannot be cast to com.sun.xml.ws.security.opt.impl.outgoing.SecurityHeader
        at com.sun.xml.wss.jaxws.impl.SecurityClientTube.processRequest(SecurityClientTube.java:252)
        at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:1136)
        at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:1050)
        at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:1019)
        at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:877)
        at com.sun.xml.ws.client.Stub.process(Stub.java:463)
        at com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:191)
        at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:108)
        at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:92)
        at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:161)
        at com.sun.proxy.$Proxy49.listAddressByPostcode(Unknown Source)
        at uk.co.example.ExampleTest.directAddressTest(ExampleTest.java:93)
        at uk.co.example.ExampleTest.main(ExampleTest.java:40)
Caused by: java.lang.ClassCastException: com.sun.xml.ws.message.jaxb.JAXBHeader cannot be cast to com.sun.xml.ws.security.opt.impl.outgoing.SecurityHeader
        at com.sun.xml.ws.security.opt.impl.JAXBFilterProcessingContext.setJAXWSMessage(JAXBFilterProcessingContext.java:166)
        at com.sun.xml.wss.jaxws.impl.SecurityTubeBase.secureOutboundMessage(SecurityTubeBase.java:384)
        at com.sun.xml.wss.jaxws.impl.SecurityClientTube.processClientRequestPacket(SecurityClientTube.java:325)
        at com.sun.xml.wss.jaxws.impl.SecurityClientTube.processRequest(SecurityClientTube.java:249)
        ... 12 more

I checked and both com.sun.xml.ws.message.jaxb.JAXBHeader and com.sun.xml.ws.security.opt.impl.outgoing.SecurityHeader are in webservices-rt-2.3.1.jar. So what is it about this particular wsdl that could cause this issue? Alternatively how can I change the way I launch the app to stop this JAXBHeader class loading?
Loading...