Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JAX-WS - NoSuchMethodError at getting Message in SOAP Handler

I am using JDK 1.6, JAX-WS RI 2.2.5 Things work perfect when no handler is added at service endpoint. But when a web method is called, after adding SOAP Handler at server side, and handler execute soapMessageContext.getMessage().toString(), the client get Internal Server Error 500 (which means server encountered an error while processing request). And at server side, following trace is printed:

Mar 14, 2012 4:26:15 PM com.sun.xml.ws.transport.http.servlet.WSServletDelegate doGet
SEVERE: caught throwable
java.lang.NoSuchMethodError: com.sun.istack.XMLStreamReaderToContentHandler.<init>(Ljavax/xml/stream/XMLStreamReader;Lorg/xml/sax/ContentHandler;ZZ[Ljava/lang/String;)V
at com.sun.xml.ws.message.stream.StreamMessage.writePayloadTo(StreamMessage.java:355)
at com.sun.xml.ws.message.stream.StreamMessage.writeTo(StreamMessage.java:462)
at com.sun.xml.ws.message.AbstractMessageImpl.readAsSOAPMessage(AbstractMessageImpl.java:198)
at com.sun.xml.ws.handler.SOAPMessageContextImpl.getMessage(SOAPMessageContextImpl.java:84)
at com.myapp.jaxws.TestingSOAPHandler.handleMessage(TestingSOAPHandler.java:21)


After some Googling, it SEEMS its libraries issue. The JAX-WS is also there in JDK 1.6 and I have also added into my project. But when I remove JAX-WS 2.2.5 libs from project, it triggers some classes missing error.

Actually I am not sure, is it libs compatibility or duplication issue or something else. Any help would be highly appreciated.

Here is the end point configuration:

<endpoint name="TestingService" implementation="com.myapp.jaxws.TestingService" url-pattern="/jaxws/TestingService" enable-mtom="true">
<handler-chains xmlns="http://java.sun.com/xml/ns/javaee">
  <handler-chain>
      <handler>
          <handler-name>MyLogicalHandler</handler-name>
          <handler-class>com.myapp.jaxws.TestingLogicalHandler</handler-class>
      </handler>
      <handler>
          <handler-name>MySOAPHandler</handler-name>
          <handler-class>com.myapp.jaxws.TestingSOAPHandler</handler-class>
      </handler>
    </handler-chain>
</handler-chains>
</endpoint>
like image 562
Asif Shahzad Avatar asked Mar 14 '12 11:03

Asif Shahzad


1 Answers

Issue resolved. It was JAXB jar conflict, another older JAXB implementation was wrongly put in classpath. And JAXWS 2.2.6 libs were not endorsed, JVM was using JDK older impl. See details here. http://www.bitspedia.com/2012/03/how-to-use-jax-ws-226-with-jdk-16.html

like image 168
Asif Shahzad Avatar answered Oct 04 '22 11:10

Asif Shahzad