EJB design: Any design pattern for Excpetion handling?
Is there any design pattern which deals with exception handling issues in J2EE architecture?
- Posted by: Vipul Sagare
- Posted on: October 29 2001 16:29 EST
On a different note... Does anybody know when is the EJB design patterns book mentioned on this website is coming out and where can I buy it from?
- Any design pattern for Excpetion handling? by Lofi Dewanto on October 30 2001 03:49 EST
- Any design pattern for Excpetion handling? by Michael Stevens on October 30 2001 07:34 EST
- Any design pattern for Excpetion handling? by Pranab Ghosh on October 30 2001 15:58 EST
Please look at this discussion:
The book "Effective Java" by Joshua Bloch has an entire chapter on exceptions. They are grouped into 9 "Items" which are sort of best practices around the use of exceptions. It's a great book that contains other useful information for Java programmers. I don't know of any specific issues or books relating to J2EE and exceptions.
I think if you are using EJBs then you must consider using Nested Exception Handling Technique.
The article which discusses Nested Exception Handling is here -->
Let me know what do you think.
I just use a generic AppException that extends the java Exception class. Typically, in my ejb methods, I throw this along with RemoteException. Appexception can nest other exceptions and is integrated with log4j. The constructor will log the error message through log4j.
Having a class hierarchy of exceptions may not be worth it, because handling them becomes tedious.
I've a sample code of this exception pattern available at http://www.myhtg.com/examples.zip
Excellent links and book(Effective Java). Really helpful!!!!
Wish had documentation for http://www.myhtg.com/examples.zip
could make a brief introduction about log4j?thanks in advance