Hello Jboss: 4.0.5GA java: 1.4
I think I'm missing something. Below you can find a simple piece of code. It is similar to every example which shows how to handle with jta transactions. It is from my stateful session bean. Ok lets look at that: UserTransaction uT = sessionContext.getUserTransaction(); | try { | uT.begin(); | | uT.setRollbackOnly(); | | uT.commit(); | | }catch (Exception ex) { | try { | System.out.println("Caught exception: " + ex.getMessage()); | uT.rollback(); | System.out.println("rollback OK"); | } catch (Exception rex){ | System.out.println("***********************"); | System.out.println("Caught exception: " + rex.getMessage()); | throw new EJBException("Rollback failed: " + rex.getMessage()); | } | throw new EJBException("Transaction failed: " + ex.getMessage()); | | } I expected to catch exception thrown by commit() method due to transaction rolled back. Then rollback transaction, and... the end. But something doesn't work like i expected. There is an exception thrown by method rollback(). Why? Below interesting output: 22:29:44,625 INFO [STDOUT] Caught exception: Already marked for rollback TransactionImpl:XidImpl[FormatId=257, GlobalId=LENOVO-98B03F24/89, BranchQual=, localId=89] OK 22:29:44,625 INFO [STDOUT] *********************** ??? 22:29:44,671 INFO [STDOUT] Caught exception: No transaction.??? 22:29:44,671 ERROR [LogInterceptor] EJBException in method: public abstract void home.main.Main.rollbackMethod() throws java.rmi.RemoteException: javax.ejb.EJBException: Rollback failed: No transaction. at home.main.MainBean.rollbackMethod(MainBean.java:128) ... Can you explain me why i cannot roll back my transaction? vitor_b View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3986998#3986998 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3986998 _______________________________________________ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user