AnsweredAssumed Answered

Activiti 5.0: Transaction Management Error for MySQL

Question asked by limcheekin on Dec 31, 2010
Latest reply on Jan 3, 2011 by jbarrez
Hi there,

First time initialization of Activiti engine will create the Activiti database schema, but it seems like Activiti engine still managed the transaction itself even an external Grails's transactionManager is assigned to org.activiti.spring.SpringProcessEngineConfiguration like the following code:

       processEngineConfiguration(org.activiti.spring.SpringProcessEngineConfiguration) {
             ……………………………..
            dataSource = ref("dataSource")
            transactionManager = ref("transactionManager")
        }

When running Activiti 5.0 with MySQL database, we are facing the following error:

2010-12-31 18:14:29,140 [main] ERROR transaction.JDBCTransaction  - JDBC commit failed
java.sql.SQLException: Can't call commit when autocommit=true
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:934)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:931)
        at com.mysql.jdbc.ConnectionImpl.commit(ConnectionImpl.java:1655)
        at org.apache.commons.dbcp.DelegatingConnection.commit(DelegatingConnection.java:334)
        at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.commit(PoolingDataSource.java:211)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy$TransactionAwareInvocationHandler.invoke(TransactionAwareDataSourceProxy.java:239)
        at $Proxy9.commit(Unknown Source)
        at org.hibernate.transaction.JDBCTransaction.commitAndResetAutoCommit(JDBCTransaction.java:170)
        at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:146)
        at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:656)
        at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:754)
        at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723)
        at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:147)
        at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:40)
        at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
        at org.activiti.engine.impl.ProcessEngineImpl.<init>(ProcessEngineImpl.java:83)
        at org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl.buildProcessEngine(ProcessEngineConfigurationImpl.java:215)
        at org.activiti.spring.SpringProcessEngineConfiguration.buildProcessEngine(SpringProcessEngineConfiguration.java:51)
        at org.activiti.spring.ProcessEngineFactoryBean.getObject(ProcessEngineFactoryBean.java:50)
        at org.activiti.spring.ProcessEngineFactoryBean.getObject(ProcessEngineFactoryBean.java:31)

This problem is not happened to H2 database. I would like to find out that is this a right behavior as Activiti engine still managed transaction itself even external transactionManager was assigned?

Please advice. Thanks.

Regards,
Chee Kin

Outcomes