3 Replies Latest reply on Dec 3, 2004 4:07 AM by Darran Lofthouse

    JBoss 4.0.0 and MySQL 4.1 setRollbackOnly() problem

    Joe Simone Newbie

      Can someone offer some plausible explanation as to why this would work:

       public String ejbCreate(AttendanceBaseDTO dto, Person person, Package regPackage)
       throws ArgumentException, CreateException, DuplicateException {
      
       try {
       ejbSelectByEventAndPersonEmailAddress(person.getEvent().getId(), person.getEmailAddress());
       //_ctx.setRollbackOnly();
       throw new DuplicateException("AttendanceBean(ejbCreate): an attendance object aleady exists for event "+
       "name \""+person.getEvent().getName()+"\" and person with email address of "+person.getEmailAddress());
       } catch (FinderException ex) {
       // not finding this person is what we are expecting. Finding person is an error as above.
       }
      


      However if I uncomment the setRollback only the code fails with the following exception ...




      15:11:42,586 ERROR [BeanLock] Saw rolled back tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=BJSLAP/1451, BranchQual=, localId=1451]
      15:11:42,586 ERROR [LogInterceptor] TransactionRolledbackLocalException in method: public abstract com.e2m.beans.entity.Event com.e2m.beans.entity.Person.getEvent(), causedBy:
      java.lang.RuntimeException: Transaction marked for rollback, possibly a timeout
       at org.jboss.ejb.plugins.lock.QueuedPessimisticEJBLock.doSchedule(QueuedPessimisticEJBLock.java:228)
       at org.jboss.ejb.plugins.lock.QueuedPessimisticEJBLock.schedule(QueuedPessimisticEJBLock.java:183)
       at org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockInterceptor.java:85)
       at org.jboss.ejb.plugins.EntityCreationInterceptor.invoke(EntityCreationInterceptor.java:53)
       at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:48)
       at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:105)
       at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:316)
       at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:149)
       at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:128)
       at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
       at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
       at org.jboss.ejb.EntityContainer.internalInvoke(EntityContainer.java:514)
       at org.jboss.ejb.Container.invoke(Container.java:854)
       at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invoke(BaseLocalProxyFactory.java:413)
       at org.jboss.ejb.plugins.local.EntityProxy.invoke(EntityProxy.java:44)
       at $Proxy757.getEvent(Unknown Source)
       at com.e2m.beans.entity.AttendanceBean.ejbCreate(AttendanceBean.java:534)
      



      I have MySQL configured for InnoDB tables. Is there anything special that needs to be done such that JBoss can roll back the transaction in MySQL??

      Many thanks,
      Joe