Hi,
I have tried searching the forums and looking in the reference manual for any information on this, but have found none.
We're seeing some strange behaviour in the error-handling for one of our SI-flows (SI version 2.0.5.RELEASE). Brief explanation:
1. The DataTransformer in the flow below is used to transform the message payload from DOMSource to a Java POJO.
2. If the request contained invalid XML, the DataTransformer will fail and throw a custom exception (TransformerException)
3. The exception is handled by the ExceptionHandler class in the transform-error chain. The ExceptionHandler iteratures through the causes of the MessagingException until it finds the custom exception type (or until it reaches the root cause).
4. The message of the custom exception is transformed to a valid XML response and returned through the incoming gateway.
The problem is that the above behaviour only works every other time. If we run this flow repeatedly using the same incorrect input data in every request, we get the desired behaviour the first time and every other time from then on. The stacktrace from the console for these desired exceptions is:Code:<bean id="incoming-gateway" class="org.springframework.integration.ws.SimpleWebServiceInboundGateway"> <property name="replyTimeout" value="25000" /> <property name="requestTimeout" value="25000" /> <property name="extractPayload" value="true" /> <property name="requestChannel" ref="requestChannel" /> <property name="errorChannel" ref="transform-error" /> </bean> <chain id="request-chain" input-channel="requestChannel"> <header-enricher> <header name="channel" method="getChannelHeader" ref="channel-HeaderEnricher" /> </header-enricher> <header-value-router header-name="channel"> <mapping value="transform" channel="transformer-channel" /> </header-value-router> </chain> <chain input-channel="transformer-channel" > <transformer method="transform"> <beans:bean class="com.example.transformation.util.DataTransformer"> </beans:bean> </transformer> </chain> <chain input-channel="transform-error"> <transformer method="transformExceptionMessageToResponse"> <beans:bean class="com.example.exceptionhandling.ExceptionHandler"> </beans:bean> </transformer> </chain>
However, the second time we run the request (and every other time from then on), the Exception thrown never contains our TransformerException among the nestled causes. Instead, the nestled causes of the MessagingException are all instances of org.springframework.integration.MessageHandlingExc eption. See stacktrace below:org.springframework.integration.MessageHandlingExc eption: handler 'org.springframework.integration.transformer.Messa geTransformingHandler@1fe84e1' requires a reply, but no reply was received
at org.springframework.integration.handler.AbstractRe plyProducingMessageHandler.handleMessageInternal(A bstractReplyProducingMessageHandler.java:104)
at org.springframework.integration.handler.AbstractMe ssageHandler.handleMessage(AbstractMessageHandler. java:78)
.......
org.springframework.integration.dispatcher.Aggrega teMessageDeliveryException: All attempts to deliver Message to MessageHandlers failed. Multiple causes:
org.springframework.integration.MessageHandlingExc eption: org.example.TransformerException: Failed to filter source.
handler 'org.springframework.integration.transformer.Messa geTransformingHandler@1fe84e1' requires a reply, but no reply was received
See below for the stacktrace of the first cause.
at org.springframework.integration.dispatcher.Unicast ingDispatcher.handleExceptions(UnicastingDispatche r.java:160)
at org.springframework.integration.dispatcher.Unicast ingDispatcher.doDispatch(UnicastingDispatcher.java :123)
.......
Caused by: org.springframework.integration.transformer.Messag eTransformationException: org.springframework.integration.MessageHandlingExc eption: org.example.TransformerException: Failed to filter source.
at org.springframework.integration.transformer.Messag eTransformingHandler.handleRequestMessage(MessageT ransformingHandler.java:73)
at org.springframework.integration.handler.AbstractRe plyProducingMessageHandler.handleMessageInternal(A bstractReplyProducingMessageHandler.java:98)
.......
Caused by: org.springframework.integration.MessageHandlingExc eption: org.example.TransformerException: Failed to filter source.
Why does this happen? Does it have anything to do with the fact that Transformers must always return a reply?org.springframework.integration.MessageHandlingExc eption: handler 'org.springframework.integration.transformer.Messa geTransformingHandler@1fe84e1' requires a reply, but no reply was received
at org.springframework.integration.handler.AbstractRe plyProducingMessageHandler.handleMessageInternal(A bstractReplyProducingMessageHandler.java:104)
at org.springframework.integration.handler.AbstractMe ssageHandler.handleMessage(AbstractMessageHandler. java:78)
....
org.springframework.integration.dispatcher.Aggrega teMessageDeliveryException: All attempts to deliver Message to MessageHandlers failed. Multiple causes:
handler 'org.springframework.integration.transformer.Messa geTransformingHandler@1fe84e1' requires a reply, but no reply was received
org.springframework.integration.MessageHandlingExc eption: org.example.TransformerException: Failed to filter source.
See below for the stacktrace of the first cause.
at org.springframework.integration.dispatcher.Unicast ingDispatcher.handleExceptions(UnicastingDispatche r.java:160)
....
Caused by: org.springframework.integration.MessageHandlingExc eption: handler 'org.springframework.integration.transformer.Messa geTransformingHandler@1fe84e1' requires a reply, but no reply was received
at org.springframework.integration.handler.AbstractRe plyProducingMessageHandler.handleMessageInternal(A bstractReplyProducingMessageHandler.java:104)
.....
at org.springframework.integration.dispatcher.Unicast ingDispatcher.doDispatch(UnicastingDispatcher.java :110)
... 137 more
org.springframework.integration.dispatcher.Aggrega teMessageDeliveryException: All attempts to deliver Message to MessageHandlers failed. Multiple causes:
handler 'org.springframework.integration.transformer.Messa geTransformingHandler@1fe84e1' requires a reply, but no reply was received
org.springframework.integration.MessageHandlingExc eption: org.example.TransformerException: Failed to filter source.
See below for the stacktrace of the first cause.
at org.springframework.integration.dispatcher.Unicast ingDispatcher.handleExceptions(UnicastingDispatche r.java:160)
at org.springframework.integration.dispatcher.Unicast ingDispatcher.doDispatch(UnicastingDispatcher.java :123)
at org.springframework.integration.dispatcher.Unicast ingDispatcher.dispatch(UnicastingDispatcher.java:9 7)
....
Caused by: org.springframework.integration.MessageHandlingExc eption: handler 'org.springframework.integration.transformer.Messa geTransformingHandler@1fe84e1' requires a reply, but no reply was received
at org.springframework.integration.handler.AbstractRe plyProducingMessageHandler.handleMessageInternal(A bstractReplyProducingMessageHandler.java:104)
at org.springframework.integration.handler.AbstractMe ssageHandler.handleMessage(AbstractMessageHandler. java:78)
....
at org.springframework.integration.dispatcher.Unicast ingDispatcher.doDispatch(UnicastingDispatcher.java :110)
... 137 more


Reply With Quote
