Hi All,
I just ran across a problem that I would like to share with you all.
This occured while using the Spring JDBC package within DAO objects used by my SLSB's.
I noticed that in WLS 8.1 That when an exception (what I considered an application exception) was being thrown that the Beans in my Bean pool were being destroyed (one at a time). I then tracked down a section in the WLS documentation that states that when a non-application exception is thrown the container will destroy the bean.
I then looked into the EJB specification and found that a non-application exception is defined as either an EJBException or any other exception extending RuntimeException. This means that the exception softening in the JDBC Spring implementation always causes my beans to be removed from the bean pool when I subclassed the Spring exceptions and declare them as application exceptions in the throws clause of the EJB method...
Changing my application exceptions to not extend any type of RuntimeException i.e. to only extend Exception (and remove the Spring Exceptions from my exception hierachy) fixed this problem...
Don't know if anybody has come across this before (or have applications they dont even realise are suffering from the same thing) but it has a significant impact on the performance of our application as the bean creation rate after some time in production becomes quite high.
The answer to this 'as stated above' is to NEVER throw an application exception from an EJB that extends RuntimeException in any way. So in our case we capture ALL Exceptions from the Spring JDBC exceptions within our DAO classes and throw application exceptions that are not derived from any RuntimeException. This does force the client to handle the exceptions with Try Catch blocks though (bit of a shame, more work on the client side, just as I was begining to enjoy removing my try catch blocks)....
Regards


Reply With Quote
