Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-4386

EJB annotations ignored if classes are packaged as JBOSS modules

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Major Major
    • None
    • JBoss AS7 7.1.1.Final
    • Class Loading, EJB
    • None
    • Hide

      Specify that the exception is an application exception in the jboss-ejb3.xml file.

      Show
      Specify that the exception is an application exception in the jboss-ejb3.xml file.

      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.

      Test.java.java
      @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_folder/modules/... folder), and the EAR declares a dependency on this module (MANIFEST.MF -> Dependencies: ....) , then the transaction is NOT rollbacked. So the EJB container ignores the annotation.

      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).

              dlloyd@redhat.com David Lloyd
              tmescic Tihomir Meščić (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: