5 Replies Latest reply on Dec 1, 2011 2:24 AM by Wolf-Dieter Fink

    Client transaction is marked for rollback by a system exception from BMT bean

    Valery Lezhebokov Newbie

      Hi All,

       

      It seems like a bug in the AS 6.0 to me. Say, I have a servlet where I start a client transaction and then call a BMT SLSB:

       

      {code}

             try{

                  Context ic = new InitialContext();

                  userTransaction = (UserTransaction) ic.lookup("java:comp/UserTransaction");

                  userTransaction.begin();

                  bean.foo();

              catch(Exception e){

                userTransaction.getStatus(); // returns javax.transaction.Status.STATUS_MARKED_ROLLBACK

              }

       

      {code}

       

      In the BMT SLSB I do the following:

       

      {code}

      @Stateless(name = "bean")

      @TransactionManagement(TransactionManagementType.BEAN)

      public class Bean implements BeanInterface {

       

          public void foo() {     

                  sessionContext.getUserTransaction().begin();

                  throw new RuntimeException("Test!");

          }

      }

      {code}

       

      So, when the foo is invoked I get a EJB exception saying that the method has started the transaction but has not finished it. That is perfectly fine.

      But then in the servlet I see that the client transaction  userTransaction gets marked for rollback!

      Isn't this against the specification?

       

      Thanks,

      Valery