This content has been marked as final. Show 3 replies
797836 wrote:Unlikely. Probably impossible.
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.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.)
I've invented a universal solvent ... But I've got nothing to put it in.
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.