2 Replies Latest reply on Oct 25, 2018 4:10 PM by SHOBHAN GANTA

    Wildfly11 not rolling back EJB 2 (CMT) Transactions

    SHOBHAN GANTA Newbie

      we are migrating from JBoss 6.1.0 to wildfly-11.0.0.Final and we are using EJB 2.0 with container managed transactions. With the wildfly we are experiencing the EJB transaction rollback issue whenever there is an exception.The transaction is being committed even though there is an exception.

      I have modified the standalone.xml to add jta="true" to datasource as shown below.

              <subsystem xmlns="urn:jboss:domain:datasources:5.0">

                      <datasource jta="true" jndi-name="java:/xxxDS" pool-name="xxxDS" enabled="true" use-java-context="true">

                          <connection-url>jdbc:oracle:thin:@xxxxx:1522:xxxxx</connection-url>

                          <driver>oracle</driver>

                          <security>

                              <user-name>xxxxx</user-name>

                              <password>xxxxx</password>

                          </security>

                      </datasource>

      Also I have tried rollback=true as shown below in ejb-jar.xml with no success.

             <application-exception>

              <exception-class>java.lang.Exception</exception-class>

              <rollback>true</rollback>

              <inherited>true</inherited>

          </application-exception>

      Where as I manually rollback the trasaction on exception using sessionContext.setRollbackOnly() in session bean, then the transaction is being rolled back.

       

      please let me know if there is a way we can rollback automatically on Exception without manually doing it?

      Thanks in advance.