0 Replies Latest reply on Feb 12, 2015 6:23 AM by tmescic

    EJB annotations ignored if classes are packaged as JBOSS modules

    tmescic

      Hi everyone,

       

      I have an EJB that writes something to the DB and I have a custom checked exception that is marked as @javax.ejb.ApplicationException(rollback=true), which means that when the exception is thrown, transaction should be rollbacked.

       

      @ApplicationException(rollback=true)
      public class MyException extends Exception {
      

       

      This exception is packaged in a separate JAR.

       

      When this JAR is included in the lib/ folder of the EAR with my EJB, everything works as expected (when the EJB throws MyException, the transaction is rollbacked).

      However, when this JAR is deployed as a JBOSS module (so, in ${jboss}/modules/... folder), and the EAR declares a dependency on this module (MANIFEST.MF -> Dependencies: ....) , then the transaction is NOT rollbacked.

       

      Why is this happening?

       

      One workaround (that I don't really like) is to specify that this is an application exception in the jboss-ejb3.xml (then, the transaction will be rollbacked).