Any design pattern for Excpetion handling?

Discussions

EJB design: Any design pattern for Excpetion handling?

  1. Any design pattern for Excpetion handling? (7 messages)

    Is there any design pattern which deals with exception handling issues in J2EE architecture?
    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?

    Thanks,

    Vipul
  2. Please look at this discussion:

    http://theserverside.com/discussion/thread.jsp?thread_id=9891

    Lofi.
  3. 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.
  4. 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 -->

    http://www.javaworld.com/javaworld/javatips/jw-javatip91.html


    Let me know what do you think.

    -Chetan
  5. 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.

    Pranab
  6. I've a sample code of this exception pattern available at http://www.myhtg.com/examples.zip
  7. Thank you.
    Excellent links and book(Effective Java). Really helpful!!!!

    Wish had documentation for http://www.myhtg.com/examples.zip

    Vipul
  8. could make a brief introduction about log4j?thanks in advance