JIRA

  • Log In Access more options
    • Online Help
    • GreenHopper Help
    • Agile Answers
    • Use Agile By Default
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What’s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • Agile Access more options (Alt+g)
  • Create Issue
  • Mule
  • MULE-3644

Expections thrown from nested router are incorrectly unwrapped

  • Agile Board
  • More Actions
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: 2.0.2
  • Fix Version/s: Bug Backlog
  • Component/s: Core: Routing / Filters
  • Labels:
    None
  • Environment:

    Linux/Ubuntu 8.04 Java Sun 1.6.0

  • User impact:
    High
  • Effort points:
    0.5
  • Similar Issues:
    None

Description

When an exception is thrown from a service which is called via a nested router, this exception is incorrectly delivered to the caller. Within Mule, this exception is wrapped in a ServiceException and transported over the Bus as an exception payload. Within the NestedInvocationHandler, the ServiceException itself is thrown to the caller. As ServiceException is a checked exception which is off course not declared on the interface implemented by the nested router, this results in a java.lang.reflect.UndeclaredThrowableException. The expected behaviour would be that the exception packed within the ServiceException would be thrown to the caller, as this exception is declared on the interface.

  • Options
    • Sort By Name
    • Sort By Date
    • Ascending
    • Descending
    • Download All

Attachments

  1. Text File
    NestedInvocationHandler.patch
    29/Aug/08 05:21 AM
    1 kB
    Jeroen Benckhuijsen

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
  • Transitions
  • Commits
  • Source
  • Builds
Hide
Permalink
Jeroen Benckhuijsen added a comment - 29/Aug/08 05:21 AM

Attached a patch which fixes the issue by unwrapping the original exception package in the ServiceException

Show
Jeroen Benckhuijsen added a comment - 29/Aug/08 05:21 AM Attached a patch which fixes the issue by unwrapping the original exception package in the ServiceException
Hide
Permalink
Daniel Feist added a comment - 18/Nov/08 08:32 PM

I agree some improvements need to be made around nested router exception handling but I think your fix will only help if a ServiceException is being returned by the remote service.

It seems the best approach might be to leave things as they are in the NestedInvocationHandler and slightly higher up in the DefaultLifecycleManager unwrap the UndeclaredThrowableException exception and throw it (possibly nested inside a BindingRoutingException). Any thoughts?

Show
Daniel Feist added a comment - 18/Nov/08 08:32 PM I agree some improvements need to be made around nested router exception handling but I think your fix will only help if a ServiceException is being returned by the remote service. It seems the best approach might be to leave things as they are in the NestedInvocationHandler and slightly higher up in the DefaultLifecycleManager unwrap the UndeclaredThrowableException exception and throw it (possibly nested inside a BindingRoutingException). Any thoughts?
Hide
Permalink
Jeroen Benckhuijsen added a comment - 19/Nov/08 04:14 AM

Wouldn´t that defy the whole point of being able to catch the thrown exceptions from the invoking code? You're right however that this only works in case the remote service throws a ServiceException, which isn't even the case always. I haven't tested it for all transports, but at least for JMS I can say that exceptions aren't returned at all to the caller, they are send to the default exception handler (which discards them into the log). For the VM-transport this works (as it is thrown form the same thread).

For my project we resorted to using a custom exception handler which would use the reply-to property of JMS to send the exception back to the caller. However that solution feels kinda hack-isch.

Anyway, I think we're dealing with two different scenarios when implementing the final solution: (1) we're just trying to bind an endpoint (e.g SMTP) to easily send data to that endpoint from Java code (e.g. a MailMessage to send an email) and (2) we're binding a remote component where Mule handles the actual transport that is used for communication (e.g. JMS, RMI, SOAP/HTTP, etc), a bit like SCA. The patch is meant for option 2 off course, can't really tell if it interferes with option 1 though.

Another issue with remote invocation (option 2) are RuntimeExceptions. We cannot send those back to the service as this may result in ClassNotFoundEx (e.g. one the called component uses Hibernate while the calling component doesn't). In my custom exception handler I would just send back a plain RuntimeException with the original stacktrace as message (based on the assumption that the invoking code can't do anything with any RE send back from the callee).

Show
Jeroen Benckhuijsen added a comment - 19/Nov/08 04:14 AM Wouldn´t that defy the whole point of being able to catch the thrown exceptions from the invoking code? You're right however that this only works in case the remote service throws a ServiceException, which isn't even the case always. I haven't tested it for all transports, but at least for JMS I can say that exceptions aren't returned at all to the caller, they are send to the default exception handler (which discards them into the log). For the VM-transport this works (as it is thrown form the same thread). For my project we resorted to using a custom exception handler which would use the reply-to property of JMS to send the exception back to the caller. However that solution feels kinda hack-isch. Anyway, I think we're dealing with two different scenarios when implementing the final solution: (1) we're just trying to bind an endpoint (e.g SMTP) to easily send data to that endpoint from Java code (e.g. a MailMessage to send an email) and (2) we're binding a remote component where Mule handles the actual transport that is used for communication (e.g. JMS, RMI, SOAP/HTTP, etc), a bit like SCA. The patch is meant for option 2 off course, can't really tell if it interferes with option 1 though. Another issue with remote invocation (option 2) are RuntimeExceptions. We cannot send those back to the service as this may result in ClassNotFoundEx (e.g. one the called component uses Hibernate while the calling component doesn't). In my custom exception handler I would just send back a plain RuntimeException with the original stacktrace as message (based on the assumption that the invoking code can't do anything with any RE send back from the callee).

People

  • Assignee:
    Daniel Feist
    Reporter:
    Jeroen Benckhuijsen
Vote (0)
Watch (0)

Dates

  • Created:
    29/Aug/08 05:20 AM
    Updated:
    19/Nov/08 05:25 AM

Agile

  • View on Board
  • Atlassian JIRA (v5.0.7#734-sha1:8ad78a6)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for MuleForge. Try JIRA - bug tracking software for your team.