Announcement Announcement Module
Collapse
No announcement yet.
I need help with exception handling in Spring Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • I need help with exception handling in Spring

    What is the latest and greatest method for exception handling in Spring?

    Trying to research this online I stated spending time on a "exceptionHandler" bean which extends from AbstractLoggingExceptionHandler but then I couldnt find such a class in any new Spring jar (3.0.5.RELEASE). So I guess this method has lost favor.

    What do I do now?

    I adopted the behavior of just throwing exceptions up to a few high level classes, and it is there I guess I need to actually call the logger to log the exceptions? Or is the current idea to just throw exceptions up and Spring handles the logging? But what if I want more customized logging? Like if I need to invoke some service on a special error?

    Also, how does this play into an error-channel, which it seems some batch feature I am using is complaining about because I dont have an error-channel defined.

  • #2
    Still confused about all this...

    Plus got another confusion... I tried to create a new log4j Appender, which logs errors to my database via the datasource.

    Well, I use Spring managed hibernate template for the DAO that does this save, however I am testing the scenario of if the DAO fails to insert, what happens? Well the result is not pretty, it ends up in an infinite loop. The hibernate template is handling the error internally, which then calls my database appender again, which initiates another error, and so on, until the connection pool is swamped.

    I need to be able to force spring to let me handle the error for this particular DAO, so that I can prevent it from throwing a new error and thus prevent the infinite loop.

    But how do I do this?

    Comment

    Working...
    X