This discussion is archived
3 Replies Latest reply: Apr 29, 2013 4:24 AM by 1006074 RSS

Generic exception handler for all scenarios

800839 Newbie
Currently Being Moderated
Hi,

I want to build a generic exception handler which can be reused in any java j2ee applications. I have java application which is communicating with other 3rd party applications like webservices, webmethods , etc from where we are getting an errorcode which will be used in our java application to do a lookup to get the respestive error message from the resource bundle. Please clarify in such case how I can go with a generic exception handler which will be build separately and will be integrated with Java applications to handle the exceptions and errors.

Please clarify.

Thanks.
  • 1. Re: Generic exception handler for all scenarios
    jschellSomeoneStoleMyAlias Expert
    Currently Being Moderated
    797836 wrote:
    Hi,

    I want to build a generic exception handler which can be reused in any java j2ee applications.
    Unlikely. Probably impossible.
    I have java application which is communicating with other 3rd party applications like webservices, webmethods , etc from where we are getting an errorcode which will be used in our java application to do a lookup to get the respestive error message from the resource bundle. Please clarify in such case how I can go with a generic exception handler which will be build separately and will be integrated with Java applications to handle the exceptions and errors.
    An excellent example of why a universal exception handler wouldn't work.

    At some point a call tree looks like A->B->C, where C (or beyond) that is where your communications problem occurs. The impact of that depends on the application.

    For example if a user types in a url (at A) and the server (C) fails to resolve it then that is a user problem.
    However if nightly batch process expects to download an update file every night from one location and it can't connect then that is an operations error (or notification/alert.)
  • 2. Re: Generic exception handler for all scenarios
    EJP Guru
    Currently Being Moderated
    I've invented a universal solvent ... But I've got nothing to put it in.
  • 3. Re: Generic exception handler for all scenarios
    1006074 Newbie
    Currently Being Moderated
    Maybe you need framework for AOP. Try to use AspectJ for example. It can wrap your business methods in common try-catch or logging code.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points