WS-Security and Tomcat error

View: New views
4 Messages — Rating Filter:   Alert me  

WS-Security and Tomcat error

by pwanner :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi everybody,

In a pervious post I found a problem when I tried to sign the SOAP response.
(http://www.nabble.com/Signing-both-request-and-response---Error-signing-response-to14029871.html)

I decided to dig a bit and I tried the apache hello_world exemple with signature and encryption of the SOAP request and response. (org.apache.cxf.systest.ws.security in Apache SVN). This is the standalone Jetty based client and server. And it works fine in both ways!

OK, so then I decided to move the server part in Tomcat. and I got the same problem on the response as described in my previous post (see the stacktrace below).

Is it a problem with Tomcat? Any idea?
Philippe


I'm using JDK 1.6.0_03 (with jaxb 2.1), Tomcat 6.0.13, CXF 2.1-SNAPSHOT and Spring 2.0.7


11 déc. 2007 11:56:00 com.sun.xml.internal.messaging.saaj.soap.MessageImpl saveChanges
GRAVE: SAAJ0539: Unable to get header stream in saveChanges
11 déc. 2007 11:56:00 com.sun.xml.internal.messaging.saaj.soap.MessageImpl saveChanges
GRAVE: SAAJ0540: Error during saving a multipart message
11 déc. 2007 11:56:00 org.apache.cxf.phase.PhaseInterceptorChain doIntercept
INFO: Interceptor has thrown exception, unwinding now
org.apache.cxf.binding.soap.SoapFault: SOAPEXCEPTION
Caused by: com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Error during saving a multipart message
Caused by: com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Unable to get header stream in saveChanges:
Caused by: java.io.IOException: org.apache.xml.serializer.ToXMLSAXHandler cannot be cast to org.apache.xml.serializer.SerializationHandler
INFO: Interceptor has thrown exception, unwinding now
org.w3c.dom.DOMException: HIERARCHY_REQUEST_ERR: An attempt was made to insert a node where it is not permitted.
org.apache.cxf.binding.soap.SoapFault: Error reading XMLStreamReader.
Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1]
Message: Premature end of file.








Re: WS-Security and Tomcat error

by dkulp :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Any chance you could try with JDK 1.5 instead of 1.6?

My gut feeling says that may fix it.   The stack trace bellow shows that
it's picking up the SAAJ implementation built into the JDK and I expect
it's getting the JAX-WS api jars, JAXB api jars, Stax implementation,
etc.... from the JDK.   We haven't done a whole lot (read: very very
little) testing with JDK 1.6 so far.     We've just started adding some
JIRA tasks for that:

https://issues.apache.org/jira/browse/CXF-1274

Dan



On Tuesday 11 December 2007, pwanner wrote:

> Hi everybody,
>
> In a pervious post I found a problem when I tried to sign the SOAP
> response.
> (http://www.nabble.com/Signing-both-request-and-response---Error-signi
>ng-response-to14029871.html)
>
> I decided to dig a bit and I tried the apache hello_world exemple with
> signature and encryption of the SOAP request and response.
> (org.apache.cxf.systest.ws.security in Apache SVN). This is the
> standalone Jetty based client and server. And it works fine in both
> ways!
>
> OK, so then I decided to move the server part in Tomcat. and I got the
> same problem on the response as described in my previous post (see the
> stacktrace below).
>
> Is it a problem with Tomcat? Any idea?
> Philippe
>
>
> I'm using JDK 1.6.0_03 (with jaxb 2.1), Tomcat 6.0.13, CXF
> 2.1-SNAPSHOT and Spring 2.0.7
>
>
> 11 déc. 2007 11:56:00
> com.sun.xml.internal.messaging.saaj.soap.MessageImpl saveChanges
> GRAVE: SAAJ0539: Unable to get header stream in saveChanges
> 11 déc. 2007 11:56:00
> com.sun.xml.internal.messaging.saaj.soap.MessageImpl saveChanges
> GRAVE: SAAJ0540: Error during saving a multipart message
> 11 déc. 2007 11:56:00 org.apache.cxf.phase.PhaseInterceptorChain
> doIntercept INFO: Interceptor has thrown exception, unwinding now
> org.apache.cxf.binding.soap.SoapFault: SOAPEXCEPTION
> Caused by: com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl:
> Error during saving a multipart message
> Caused by: com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl:
> Unable to get header stream in saveChanges:
> Caused by: java.io.IOException:
> org.apache.xml.serializer.ToXMLSAXHandler cannot be cast to
> org.apache.xml.serializer.SerializationHandler INFO: Interceptor has
> thrown exception, unwinding now
> org.w3c.dom.DOMException: HIERARCHY_REQUEST_ERR: An attempt was made
> to insert a node where it is not permitted.
> org.apache.cxf.binding.soap.SoapFault: Error reading XMLStreamReader.
> Caused by: javax.xml.stream.XMLStreamException: ParseError at
> [row,col]:[1,1]
> Message: Premature end of file.



--
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@...
http://www.dankulp.com/blog

RESOLVED: WS-Security and Tomcat error

by pwanner :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thank you for your answer Dan!

After googeling a bit with one of the error in the stacktrace (SAAJ0539) I found a thread where they say to try to put the Xerces 2.8.1 and Xalan 2.7.0 on the server-side(http://forum.springframework.org/archive/index.php/t-38582.html).

I put xalan-2.0.7 and xercesImpl-2.9.0 jars in the %TOMCAT_HOME%/common/endorsed folder and surprise, it works! Seems it's a bug in the xml parser in the Tomcat dist.

Thanks again for the help!


dkulp wrote:
Any chance you could try with JDK 1.5 instead of 1.6?

My gut feeling says that may fix it.   The stack trace bellow shows that
it's picking up the SAAJ implementation built into the JDK and I expect
it's getting the JAX-WS api jars, JAXB api jars, Stax implementation,
etc.... from the JDK.   We haven't done a whole lot (read: very very
little) testing with JDK 1.6 so far.     We've just started adding some
JIRA tasks for that:

https://issues.apache.org/jira/browse/CXF-1274

Dan



On Tuesday 11 December 2007, pwanner wrote:
> Hi everybody,
>
> In a pervious post I found a problem when I tried to sign the SOAP
> response.
> (http://www.nabble.com/Signing-both-request-and-response---Error-signi
>ng-response-to14029871.html)
>
> I decided to dig a bit and I tried the apache hello_world exemple with
> signature and encryption of the SOAP request and response.
> (org.apache.cxf.systest.ws.security in Apache SVN). This is the
> standalone Jetty based client and server. And it works fine in both
> ways!
>
> OK, so then I decided to move the server part in Tomcat. and I got the
> same problem on the response as described in my previous post (see the
> stacktrace below).
>
> Is it a problem with Tomcat? Any idea?
> Philippe
>
>
> I'm using JDK 1.6.0_03 (with jaxb 2.1), Tomcat 6.0.13, CXF
> 2.1-SNAPSHOT and Spring 2.0.7
>
>
> 11 déc. 2007 11:56:00
> com.sun.xml.internal.messaging.saaj.soap.MessageImpl saveChanges
> GRAVE: SAAJ0539: Unable to get header stream in saveChanges
> 11 déc. 2007 11:56:00
> com.sun.xml.internal.messaging.saaj.soap.MessageImpl saveChanges
> GRAVE: SAAJ0540: Error during saving a multipart message
> 11 déc. 2007 11:56:00 org.apache.cxf.phase.PhaseInterceptorChain
> doIntercept INFO: Interceptor has thrown exception, unwinding now
> org.apache.cxf.binding.soap.SoapFault: SOAPEXCEPTION
> Caused by: com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl:
> Error during saving a multipart message
> Caused by: com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl:
> Unable to get header stream in saveChanges:
> Caused by: java.io.IOException:
> org.apache.xml.serializer.ToXMLSAXHandler cannot be cast to
> org.apache.xml.serializer.SerializationHandler INFO: Interceptor has
> thrown exception, unwinding now
> org.w3c.dom.DOMException: HIERARCHY_REQUEST_ERR: An attempt was made
> to insert a node where it is not permitted.
> org.apache.cxf.binding.soap.SoapFault: Error reading XMLStreamReader.
> Caused by: javax.xml.stream.XMLStreamException: ParseError at
> [row,col]:[1,1]
> Message: Premature end of file.



--
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog

Re: WS-Security and Tomcat error

by Glen Mazza-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

You can also trace your Tomcat-hosted (i.e. web service) code from
Eclipse if that would help.  (I just figured out how to do this recently
myself: http://www.jroller.com/gmazza/date/20071212 .)

Glen


Am Dienstag, den 11.12.2007, 16:46 -0500 schrieb Daniel Kulp:

> Any chance you could try with JDK 1.5 instead of 1.6?
>
> My gut feeling says that may fix it.   The stack trace bellow shows that
> it's picking up the SAAJ implementation built into the JDK and I expect
> it's getting the JAX-WS api jars, JAXB api jars, Stax implementation,
> etc.... from the JDK.   We haven't done a whole lot (read: very very
> little) testing with JDK 1.6 so far.     We've just started adding some
> JIRA tasks for that:
>
> https://issues.apache.org/jira/browse/CXF-1274
>
> Dan
>
>
>
> On Tuesday 11 December 2007, pwanner wrote:
> > Hi everybody,
> >
> > In a pervious post I found a problem when I tried to sign the SOAP
> > response.
> > (http://www.nabble.com/Signing-both-request-and-response---Error-signi
> >ng-response-to14029871.html)
> >
> > I decided to dig a bit and I tried the apache hello_world exemple with
> > signature and encryption of the SOAP request and response.
> > (org.apache.cxf.systest.ws.security in Apache SVN). This is the
> > standalone Jetty based client and server. And it works fine in both
> > ways!
> >
> > OK, so then I decided to move the server part in Tomcat. and I got the
> > same problem on the response as described in my previous post (see the
> > stacktrace below).
> >
> > Is it a problem with Tomcat? Any idea?
> > Philippe
> >
> >
> > I'm using JDK 1.6.0_03 (with jaxb 2.1), Tomcat 6.0.13, CXF
> > 2.1-SNAPSHOT and Spring 2.0.7
> >
> >
> > 11 déc. 2007 11:56:00
> > com.sun.xml.internal.messaging.saaj.soap.MessageImpl saveChanges
> > GRAVE: SAAJ0539: Unable to get header stream in saveChanges
> > 11 déc. 2007 11:56:00
> > com.sun.xml.internal.messaging.saaj.soap.MessageImpl saveChanges
> > GRAVE: SAAJ0540: Error during saving a multipart message
> > 11 déc. 2007 11:56:00 org.apache.cxf.phase.PhaseInterceptorChain
> > doIntercept INFO: Interceptor has thrown exception, unwinding now
> > org.apache.cxf.binding.soap.SoapFault: SOAPEXCEPTION
> > Caused by: com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl:
> > Error during saving a multipart message
> > Caused by: com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl:
> > Unable to get header stream in saveChanges:
> > Caused by: java.io.IOException:
> > org.apache.xml.serializer.ToXMLSAXHandler cannot be cast to
> > org.apache.xml.serializer.SerializationHandler INFO: Interceptor has
> > thrown exception, unwinding now
> > org.w3c.dom.DOMException: HIERARCHY_REQUEST_ERR: An attempt was made
> > to insert a node where it is not permitted.
> > org.apache.cxf.binding.soap.SoapFault: Error reading XMLStreamReader.
> > Caused by: javax.xml.stream.XMLStreamException: ParseError at
> > [row,col]:[1,1]
> > Message: Premature end of file.
>
>
>