EJB exception handling is an important but rarely written-about topic. However, a new article on developerworks discusses exception handling in EJB and best practices for dealing with them.
Read Best Practices in EJB Exception Handling.
-
Best Practices in EJB Exception Handling (5 messages)
- Posted by: Floyd Marinescu
- Posted on: May 29 2002 10:42 EDT
Threaded Messages (5)
- Best Practices in EJB Exception Handling by Praveen Allam on May 29 2002 15:53 EDT
- Best Practices in EJB Exception Handling by Haytham A on May 29 2002 22:03 EDT
- Best Practices in EJB Exception Handling by Tony Brookes on May 31 2002 21:33 EDT
- Best Practices in EJB Exception Handling by Srinivas Pogiri on June 02 2002 00:06 EDT
- Best Practices in EJB Exception Handling by Prabahar K on January 20 2005 09:35 EST
-
Best Practices in EJB Exception Handling[ Go to top ]
- Posted by: Praveen Allam
- Posted on: May 29 2002 15:53 EDT
- in response to Floyd Marinescu
Description of various types of Exception is very concrete. However, the article does not give any clear picture of design patterns. It would have been more useful if author spends some more time on design patterns. -
Best Practices in EJB Exception Handling[ Go to top ]
- Posted by: Haytham A
- Posted on: May 29 2002 22:03 EDT
- in response to Floyd Marinescu
He made good points about when to warp an exception and throw it as a system or an application exception. Also writing your custom RuntimeException class for the purpose of logging exceptions is cool. -
Best Practices in EJB Exception Handling[ Go to top ]
- Posted by: Tony Brookes
- Posted on: May 31 2002 21:33 EDT
- in response to Haytham A
A good discussion, although I disagree with the premise that you should log your exceptions where you catch them.
What about when you're writing adapters, or utility classes etc. These are typically used across many different areas of your code base, so the utility or adapter can't be the place to put the logging code.
Logging is supposed to be contextual, and the best logging practices I have seen focus on logging things in the context of what the application is meant to do, not how it is going about it. That type of logging is typically done at a relatively high level in the system, which is where I would expect exceptions to get logged, not down in the depths of where they first occur.
Just my 2c worth. Good article though. Personally I am fed up with trying to trouble-shoot other peoples code when exceptions get swallowed or mess up STDERR.
Now, if someone could just tell the JCE folks to do some exception chaining perhaps we could all figure out what the hell is actually happening when we get "Error getting Trusted Certs" exception from JCE in WebLogic! :)
Chz
Tony -
Best Practices in EJB Exception Handling[ Go to top ]
- Posted by: Srinivas Pogiri
- Posted on: June 02 2002 00:06 EDT
- in response to Floyd Marinescu
I would like to know what is the best strategy of throwing exception from EJBs in the case of RMI/IIOP. Any suggestion is greatly appreciated.
Thanks
Srini -
Best Practices in EJB Exception Handling[ Go to top ]
- Posted by: Prabahar K
- Posted on: January 20 2005 09:35 EST
- in response to Srinivas Pogiri
Its a good article. Can anyone give details on how to handle application exceptions when the ejb exposed as webservices throws an exception, how to catch that in the webtier which is a struts based and display appropriate message to the end user.
Prabahar