5 Replies Latest reply on Oct 21, 2005 3:10 AM by Nicolas Leroux

    Problem with UserTransaction and EJB3 stateless bean

    Nicolas Leroux Newbie

      Hi,

      I have the following error trying to use UserTransaction:

      javax.transaction.NotSupportedException: Transaction already active, cannot nest transactions.
      2005-10-18 17:45:22,323 INFO at org.jboss.tm.TxManager.begin(TxManager.java:193)
      2005-10-18 17:45:22,323 INFO at org.jboss.ejb3.tx.UserTransactionImpl.begin(UserTransactionImpl.java:49)
      ...

      My stateless ejb3 bean is using the BEAN transactionManagement:

      @Stateless
      @TransactionManagement ( TransactionManagementType.BEAN )

      and the UserTransaction is injected using:
      @Resource
      UserTransaction ut;

      As soon as I try to start a transaction (ut.begin()) the error occurs. And of course, I am not starting a transaction anywhere else. So I should not be in a nested transaction (except for the ones managed by the container).

      Is this a bug or am doing something wrong?

      Nicolas