General J2EE: Error Handling and sending mails(urgent)
- Posted by: ashutosh kumar
- Posted on: August 02 2003 02:41 EDT
Pls give me tips on doing error handling and sending mails about errors to various persons .
lot of thanx
- Elobrate your question by Raheel haider on August 02 2003 03:27 EDT
- error handling and crash recovery by ashutosh kumar on August 02 2003 05:12 EDT
> Pls give me tips on doing error handling and sending mails about errors to various persons .
> lot of thanx
Hi please elobrate your question, from current message i think that you are getting problem in sending mail
No its not problem of sending mails. I want to know a good design for error handling and also about crash recovery for weblogic integration server.
I guess you can define your own exception class derived from Exception. That way you can have some additional methods in ur exception to handle ur specific requirement.
My general way will be to send mails at the end of the exception hirarchy.
i.e. all exception travel upward towards the main calling function. make sure that your customize class has a method to send error report via mails.
or write a helper class which will send mails and take your exception object as a parameter.
This is pretty common practice
Hope this helps
can u send me lld for it.it will help me.
can u eloborate me how all exceptions travel upwards.can u send me a lld for it on kumar dot ashutosh at seepz dot tcs dot co.in
exception traveling upward is a basic oop funda. I guess you know that, but I might have put it in such a way that you thought I am talking about something else.
ok so say ur servlet makes a call to some helper class and inter the helper class calls other class where the exception is happening,
ServletCall - > helper one-> helper two.
now helper two has caught IOException in ur helpter two catch block
instanciate ur custom exception with ur business domain related message.
and throw the exception. offcourse ur helper two method need to declare throws custom exception in method signature.
how u r gonna catch custom exception in ur servletcall
and once u have the exception object u can use the exception.getMessage to get ur business domain related message which was populated at helper 2 level.
sorry for later reply, didnt see that u have posted some queries.
hope this helps