Results 1 to 6 of 6

Thread: SAAJ or Spring WS swallowing errors?

  1. #1
    Join Date
    Feb 2006
    Posts
    164

    Default SAAJ or Spring WS swallowing errors?

    Hi, Arjen (or anyone else who thinks they might know the answer).

    I'm looking at what apparently looks like a swallowed stack trace. I have log4j set to DEBUG level for Spring, and it's showing good data, except for this one, so I'm not sure if the swallow is in Spring or in SAAJ code, or ?

    Anyway, here's the error shown in the tomcat log:

    Code:
    Marshalling [javax.xml.bind.JAXBElement@916ab8] to response payload
    Testing endpoint exception resolver [org.springframework.ws.soap.endpoint.SoapFa
    ultMappingExceptionResolver@5866c1]
    Could not complete request
    java.lang.IllegalStateException: Response already created
            at org.springframework.ws.soap.context.AbstractSoapMessageContext.create
    SoapResponse(AbstractSoapMessageContext.java:51)
            at org.springframework.ws.soap.endpoint.SoapFaultMappingExceptionResolve
    r.resolveExceptionInternal(SoapFaultMappingExceptionResolver.java:75)
            at org.springframework.ws.endpoint.AbstractEndpointExceptionResolver.res
    olveException(AbstractEndpointExceptionResolver.java:61)
            at org.springframework.ws.MessageDispatcher.processEndpointException(Mes
    sageDispatcher.java:360)
            at org.springframework.ws.MessageDispatcher.dispatch(MessageDispatcher.j
    ava:261)
            at org.springframework.ws.MessageDispatcher.invoke(MessageDispatcher.jav
    a:209)
            at org.springframework.ws.transport.http.MessageHandlerAdapter.handle(Me
    ssageHandlerAdapter.java:57)
            at org.springframework.web.servlet.DispatcherServlet.doDispatch(Dispatch
    erServlet.java:723)
            at org.springframework.web.servlet.DispatcherServlet.doService(Dispatche
    rServlet.java:663)
            at org.springframework.web.servlet.FrameworkServlet.processRequest(Frame
    workServlet.java:394)
            at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServ
    let.java:358)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
    icationFilterChain.java:252)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
    ilterChain.java:173)
            at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
    alve.java:213)
            at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
    alve.java:178)
            at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
    ava:126)
            at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
    ava:105)
            at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
    ve.java:107)
            at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
    a:148)
            at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
    :869)
            at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.p
    rocessConnection(Http11BaseProtocol.java:664)
            at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpo
    int.java:527)
            at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFol
    lowerWorkerThread.java:80)
            at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadP
    ool.java:684)
            at java.lang.Thread.run(Thread.java:595)
    Publishing event in context [WebApplicationContext for namespace 'utdEditorSprin
    gWS-servlet']: RequestHandledEvent: url=[/utdEditor/UtdEditor]; time=[113236ms];
     client=[10.1.20.33]; method=[POST]; servlet=[utdEditorSpringWS]; session=[null]
    ; user=[null]; status=[failed: java.lang.IllegalStateException: Response already
     created]
    Publishing event in context [Root WebApplicationContext]: RequestHandledEvent: u
    rl=[/utdEditor/UtdEditor]; time=[113236ms]; client=[10.1.20.33]; method=[POST];
    servlet=[utdEditorSpringWS]; session=[null]; user=[null]; status=[failed: java.l
    ang.IllegalStateException: Response already created]
    ...but when I step through SoapMessageDispatcher(MessageDispatcher).dispatch( MessageContext) line: 260, I see this (essentially) in the Eclipse Debugger Variables tab:

    Code:
    SoapMessageDispatcher this= SoapMessageDispatcher  (id=67)
    Exception ex= JaxbMarshallingFailureException  (id=228)
    	Throwable cause (Throwable)= JaxbMarshallingFailureException  (id=228)
    		Throwable cause (Throwable)= JaxbMarshallingFailureException  (id=228)
    		Throwable cause (NestedRuntimeException)= MarshalException  (id=230)
    		String detailMessage= "JAXB marshalling exception: null"
    		StackTraceElement[] stackTrace= null
    	Throwable cause (NestedRuntimeException)= MarshalException  (id=230)
    		Throwable cause= MarshalException  (id=230)
    		String detailMessage= null
    		String errorCode= null
    		Throwable linkedException= SAXParseException  (id=233)
    			Throwable cause= SAXParseException  (id=233)
    			int columnNumber= 0 [^@ (NUL)]
    			String detailMessage= "cvc-complex-type.2.4.a: Invalid content was found starting with element 'Parms'. One of '{"http://www.mycompany.com":Msg}' is expected."
    			Exception exception= null
    			int lineNumber= 0 [^@ (NUL)]
    			String publicId= null
    			StackTraceElement[] stackTrace= null
    			String systemId= null
    		StackTraceElement[] stackTrace= null
    	String detailMessage= "JAXB marshalling exception: null"
    	StackTraceElement[] stackTrace= null
    MessageContext messageContext= SaajSoapMessageContext  (id=226)
    EndpointInvocationChain mappedEndpoint= SoapEndpointInvocationChain  (id=229)
    int interceptorIndex= 0 [^@ (NUL)]
    As you can see, the REAL culprit is a SaxParseException, the useful details of which are being swallowed by something (SAAJ? SpringWS?).

    Can we (you or I) get it to stop swallowing these vital error messages somehow. I mean, without such, how would we reasonably debug this kind of thing in production?

    I will now state, to the current java world, a proposed philosophy on error handling in software. This is just my opinion, but is based on years and years of real-world financial/insurance app development. Most software managers, and my wife, who can barely use a computer, find it intuitively obvious as soon as I say it, and yet few of today's software systems actually implement it well, probably because (a) the state-of-the-art for meaningful error-handling/reporting is, after 50 or so years, still apparently in its infancy, and (b) the rest of the software is advancing so quickly on other fronts, that there is never a good incentive to build complete, robust error-handling systems:

    "The symptom of an error should lead the user naturally and intuitively to a solution."

    Addendum: "All software developers, even assembler programmers, are, at some level, 'users'."

    Code that swallows errors obviously does not lead the user naturally and intuitively to a solution.

    Again, I'm not picking on Spring. Just making a general statement about the state of java, and possibly all programming going on today, coz the problem keeps coming up over and over again in all the software I use...and, perhaps in the software I write as well

    Ben

  2. #2
    Join Date
    Jul 2005
    Location
    Rotterdam, the Netherlands
    Posts
    1,562

    Default

    The issue you ran it to occurred when Spring-WS tried to create a SOAP Fault response after a response message was already created. That used to throw an exception, but doesn't do that anymore in the current codebase. The 1.0-M2 release I will do next week will not have this behavior anymore.
    Arjen Poutsma

    Spring Web Services Dev Lead
    Please read the FAQ

  3. #3
    Join Date
    Feb 2006
    Posts
    164

    Default

    Thanks, Arjen.

    Overall Spring Web Service is working out very well for us, in our initial, and fairly robust tests using a Microsoft .net client.

    Ben

  4. #4
    Join Date
    Jun 2006
    Location
    outside boston
    Posts
    108

    Default pending release?

    Hello Arjen,
    Any update on the Spring-WS 1.0 M2 release?
    I'm interested in the solution to this "response already created" issue as well.


    I'm not sure why my invokeInternal would have an error anyway, but maybe the change you are making will help inform me?

    My code is:

    <code>
    protected Object invokeInternal(Object requestObject) throws Exception {
    JAXBElement<TopicRetrieveRequestType> rqElement = (JAXBElement<TopicRetrieveRequestType>) requestObject;
    TopicRetrieveRequestType request = rqElement.getValue();
    Topic topic = this.topicService.retrieveTopic(1);
    TopicRetrieveResponseType topicRetrieveResponse = new TopicRetrieveResponseType();
    topicRetrieveResponse.setTopic(topic.getTopicInfo( ));
    topicRetrieveResponse.setTopicId(topic.getTopicId( ));
    return topicRetrieveResponse;

    }
    </code>

    I can see that the topicRetrieveResponse looks ok, I don't know what goes wrong.

  5. #5
    Join Date
    Jul 2005
    Location
    Rotterdam, the Netherlands
    Posts
    1,562

    Default

    Quote Originally Posted by farrellr
    Any update on the Spring-WS 1.0 M2 release?
    I hoped to do it last week, but couldn't because of work for a client. Hopefully, I will be able to do it this week.


    Quote Originally Posted by farrellr
    I'm interested in the solution to this "response already created" issue as well.
    The 'response already created' issue has been solved in the latest nightly builds, which you can download from here: http://www.springframework.org/spring-ws/snapshots.
    Arjen Poutsma

    Spring Web Services Dev Lead
    Please read the FAQ

  6. #6
    Join Date
    Jun 2006
    Location
    outside boston
    Posts
    108

    Default different issue with the nightly build?

    Thanks Arjen - I know you guys are busy, just thought I'd check on the release.
    I did try the 8/18 build, modifying some of the package names for interceptors etc, and its running now.
    Thanks.
    Last edited by farrellr; Aug 22nd, 2006 at 10:26 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •