0 Replies Latest reply on Sep 13, 2018 8:24 AM by tmauch

    EJBException in TransactionPhase.AFTER_SUCCESS annotated with TransactionAttributeType.NEVER

    tmauch

      I encounter the following issue with Wildlfy which can be reproduced by the attached test case if the method testEvent is executed.

      - testEvent() is executed in transactional context and fires an event

      - afterTransaction() listens for the event with TransactionPhase.AFTER_SUCCESS

      - afterTransaction is annotated withTransactionAttributeType.NEVER which makes Wildfly throw an execption

       

      I have the issue on both Wildlfy 10.1.0-FINAL and Wildfly 13.0.0-FINAL.

       

      ####2018-09-07 07:30:40,747 ThreadId:398 ERROR [logger: org.jboss.as.ejb3.invocation] - WFLYEJB0034: EJB Invocation failed on component X for method public void X(): javax.ejb.EJBException: WFLYEJB0063: Transaction present on server in Never call (EJB3 13.6.2.6)

          at org.jboss.as.ejb3.tx.CMTTxInterceptor.never(CMTTxInterceptor.java:297)

      ...

          at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:313)

          at org.jboss.weld.event.TransactionSynchronizedRunnable.afterCompletion(TransactionSynchronizedRunnable.java:54)

          at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1200)

          at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:126)

       

      In my opinion this is an issue in Wildfly as the old transaction is already finished and I state that I do not want a transaction in the new call.

      You can also see in the stacktrace that Wildlfy calls commitAndDisassociate() which supports my opinion.

      Also the same test case works fine in Weblogic.

       


      Testcase:

      @Singleton
      public class TestEvent {

          private static final Logger LOGGER = LoggerFactory.getLogger(TestEvent.class);

          static class MyEvent {
          }

          @Inject
          Event<MyEvent> eventSender;

          @TransactionAttribute(TransactionAttributeType.REQUIRED)
          public void testEvent() {
              LOGGER.info("execute");
              eventSender.fire(new MyEvent());
          }

          @TransactionAttribute(TransactionAttributeType.NEVER)
          public void afterTransaction(@Observes(during = TransactionPhase.AFTER_SUCCESS) MyEvent event) {
              LOGGER.info("afterTransaction");
          }

      }