0 Replies Latest reply on Feb 11, 2014 2:24 PM by Rafael Vanderlei de Souza

    Why is JBoss EAP 6.1 logging my ApplicationException* as ERROR?

    Rafael Vanderlei de Souza Newbie



      I have the following hierarchy of exceptions:



      public class ExceptionA extends Exception{...}


      public class ExceptionB extends ExceptionA{...}


      When ExceptionB is thrown by a method in some EJB, JBoss log the following line (along with the call stacktrace) in server.log :


      12:53:21,639 ERROR [org.jboss.as.ejb3.invocation] (ajp-/ JBAS014134: A Invoca褯 EJB falhou no <EJB_NAME> do componente para o <METHOD_SIGNATURE> throws <EXCEPTION_FULLY_QUALIFIED_CLASS_NAME> do m굯do: <EXCEPTION_FULLY_QUALIFIED_CLASS_NAME>: <exception.getMessage()>.

      ... stacktrace ...


      (The server is configure with locale pt-BR, but the message in English may be something like "EJB invocation failed at <EJB> component for <METHOD>: <Exception class>: <Exception Message>)


      Despite the log message printed, the behavior observed was the same as ApplicationException (as per spec), i.e., transaction was committed and the client received ExceptionB in the catch(){} clause, instead of javax.ejb.EJBException.


      According to EJB 3.1 specification (section 14.3.1, page 384), I believe the container should not log the exception, because this must be done only for exceptions other than ApplicationExceptions, right?


      Another thing that is confusing me is ... well, if JBoss is logging the error because ExceptionB, despite being checked exception, is not being considered to be ApplicationException because of inherited=false demarcation on ExceptionA, why isn't it being encapsulated in a javax.ejb.EJBException and isn't marking the transaction for rollback? It's like the logging subsystem is treating the exception as a non ApplicationException, while on the other hand the transaction subsystem is treating the exception as a ApplicationException.


      Can anyone help me clarify this?