PostgreSQL: Cannot commit when autoCommit is enabled

I am experiencing the issue previously reported with Flowable 6.7.0 (not v5) and PostgreSQL (no errors with 6.6.0).

The full stacktrace is

org.apache.openjpa.persistence.PersistenceException: Cannot commit when autoCommit is enabled.
syncope_1          |            at org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:408)
syncope_1          |            at org.springframework.orm.jpa.DefaultJpaDialect.translateExceptionIfPossible(DefaultJpaDialect.java:128)
syncope_1          |            at org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:538)
syncope_1          |            at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:743)
syncope_1          |            at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:711)
syncope_1          |            at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:152)
syncope_1          |            at org.flowable.common.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:57)
syncope_1          |            at org.flowable.common.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:30)
syncope_1          |            at org.flowable.common.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:56)
syncope_1          |            at org.flowable.eventregistry.impl.EventRegistryEngineImpl.<init>(EventRegistryEngineImpl.java:47)
syncope_1          |            at org.flowable.eventregistry.impl.EventRegistryEngineConfiguration.buildEventRegistryEngine(EventRegistryEngineConfiguration.java:195)
syncope_1          |            at org.flowable.eventregistry.spring.SpringEventRegistryEngineConfiguration.buildEventRegistryEngine(SpringEventRegistryEngineConfiguration.java:73)
syncope_1          |            at org.flowable.eventregistry.spring.configurator.SpringEventRegistryConfigurator.initEventRegistryEngine(SpringEventRegistryConfigurator.java:57)
syncope_1          |            at org.flowable.eventregistry.spring.configurator.SpringEventRegistryConfigurator.configure(SpringEventRegistryConfigurator.java:47)
syncope_1          |            at org.flowable.common.engine.impl.AbstractEngineConfiguration.configuratorsAfterInit(AbstractEngineConfiguration.java:1107)
syncope_1          |            at org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl.init(ProcessEngineConfigurationImpl.java:1012)
syncope_1          |            at org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl.buildProcessEngine(ProcessEngineConfigurationImpl.java:900)
syncope_1          |            at org.flowable.spring.SpringProcessEngineConfiguration.buildProcessEngine(SpringProcessEngineConfiguration.java:76)

As said above, it works flawlessly with other DBMS as MySQL and H2.

Any suggestion?

Interesting problem, this happens when the event registry Schema is created. We are using the TransactionTemplate since that’s how the engine is configured to control the transactions.

Did you only upgrade Flowable or you also upgraded other dependencies, like Spring JPA in the same time?

You could also try to see what happens when you use the TransactionTemplate using the PlatformTransactionManager from Spring.

If you do without Flowable

TransactionTemplate transactionTemplate = new TransactionTemplate(transactionManager);
            transactionTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
            transactionTemplate.execute(status -> {
                // do nothing
                return null;
            })

you should be able to pinpoint the problem better I think. In the end this is what we do in the SpringTransactionInterceptor

1 Like

The only upgrade was Flowable - see Upgrading Flowable · apache/syncope@b76306c · GitHub

Since we don’t seem to need the Event Registry at all, for the moment I am applying as workaround the following change to our conf:

conf.setDisableEventRegistry(true);