[jboss-user] [EJB/JBoss] - custom ejb exception handler?

khelenek do-not-reply at jboss.com
Mon Oct 15 10:48:43 EDT 2007


I'm curious if there are any hooks into the handling of runtime exceptions that propagate up through an EJB.  The default behavior is to rollback a transaction and log the error.  What I would like to be able to do is add my own custom logging here to add additional information on errors. 

Let me back up and present the problem.  Sometimes I get a hibernate runtime exception, which logs a stacktrace showing a series of "caused by's", until finally reaching something like this:

Caused by: java.sql.BatchUpdateException: Batch entry 0 insert into some_table... was aborted.  Call getNextException to see the cause.
  | 
I would really like to get that getNextException() part logged as it is usually the most useful part of the exception.  And i want to do it in a "global" sort of way without catching, logging, and rethrowing on every ejb method i have. 

Thought also about making my own log4j appender but I'm not sure if that approach would work. Any other ideas or suggestions?

Thanks!
Kris

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4095276#4095276

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4095276



More information about the jboss-user mailing list