Announcement Announcement Module
No announcement yet.
Error handling - global error channel Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Error handling - global error channel

    Hi all,
    I am new in Spring integration, and I want to test error handling with the following scenario:
    1. A client send an order (O) to a front end web service A,
    2. This web service A, get information from a web service B to enrich O,
    3. There is a data mapping to create a new order O1
    4. Then, this order O1 is send to a back end web service C,
    5. Voluntary, C throws a WebServiceException.

    I want to handle all exception with the global errorChannel.
    I create all channels with "queue" sub element to make them pollable as explained in Spring integration documentation, but the exception is never catched in the errorChannel.
    Can someone have a look on my code and explain me where is my error.
    Thanks in advance,
    Best regards

    My configuration:
    Java Jdk 1.5
    Spring Integration 1.0.2
    Spring framework 2.5.5

  • #2
    I have no direct reply to your situation but I will make a comment about your XML namespace config.
    This may not have an effect on your setup anyway.

    You are using integration as the default namespace and so there is no need to declare it again.

    I think you have duplicated by using


    • #3
      I have no time to reproduce with a simplified configuration at the moment unfortunately. I didn't spot any obvious mistakes at a first glance. Could you try to reproduce this in a simple testcase (and create a JIRA from it if you can)?

      Again, I'd love to dig into this a bit, but you don't want to hold your breath until I have time for that. Business first, unfortunately


      • #4
        I'm pretty sure your Messages are probably going to the channel you created called "defaultErrorChannel" (i.e. they're not matching the one Exception type that you explicitly mapped).

        It looks like you don't have any endpoint receiving messages from the "defaultErrorChannel". Try adding something with that as its "input-channel" and see if that's where your messages are going.

        Hope that helps.


        • #5
          I create all channels with "queue" sub element to make them pollable as explained in Spring integration documentation,
          but the exception is never catched in the errorChannel.
          It appears that the only reason you have made your channels pollable
          is so that you can direct exceptions to the error channel.

          That has, to me, the effect of making your configuration overly complex.

          Wouldn't you rather have direct channels and handle exceptions in your business logic?


          • #6
            I Mark,
            Thanks for your answer.
            I added a handler with defaultErrorChannel, but the result is the same. The code of the error handler is not executed.
            As Hicyo said in his post, errorchannel seems does not catch the Exception.

            This is my trace that prove WebServiceException is raised

            org.springframework.integration.message.MessageHan dlingException: error occurred in message handler [ServiceActivator for [org.springframework.integration.handler.MessageMap pingMethodInvoker@55d4d1]]
            at org.springframework.integration.handler.AbstractMe ssageHandler.handleMessage(AbstractMessageHandler. java:54)
            at org.springframework.integration.endpoint.PollingCo nsumer.doPoll(
            at org.springframework.integration.endpoint.AbstractP ollingEndpoint$Poller.innerPoll(AbstractPollingEnd
            at org.springframework.integration.endpoint.AbstractP ollingEndpoint$Poller.poll(AbstractPollingEndpoint .java:216)
            at org.springframework.integration.endpoint.AbstractP ollingEndpoint$ java:209)
            at org.springframework.integration.scheduling.SimpleT askScheduler$
            at java.util.concurrent.Executors$ l(
            at java.util.concurrent.FutureTask$Sync.innerRunAndRe set(
            at java.util.concurrent.FutureTask.runAndReset(Future
            at org.springframework.integration.scheduling.SimpleT askScheduler$ .java:256)
            at java.util.concurrent.ThreadPoolExecutor$ Task(
            at java.util.concurrent.ThreadPoolExecutor$ (
            Caused by: WebServiceException - [CRISTAL BACK]
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)