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(
syncope_1          |            at org.springframework.orm.jpa.DefaultJpaDialect.translateExceptionIfPossible(
syncope_1          |            at org.springframework.orm.jpa.JpaTransactionManager.doCommit(
syncope_1          |            at
syncope_1          |            at
syncope_1          |            at
syncope_1          |            at org.flowable.common.spring.SpringTransactionInterceptor.execute(
syncope_1          |            at org.flowable.common.engine.impl.interceptor.LogInterceptor.execute(
syncope_1          |            at org.flowable.common.engine.impl.cfg.CommandExecutorImpl.execute(
syncope_1          |            at org.flowable.eventregistry.impl.EventRegistryEngineImpl.<init>(
syncope_1          |            at org.flowable.eventregistry.impl.EventRegistryEngineConfiguration.buildEventRegistryEngine(
syncope_1          |            at org.flowable.eventregistry.spring.SpringEventRegistryEngineConfiguration.buildEventRegistryEngine(
syncope_1          |            at org.flowable.eventregistry.spring.configurator.SpringEventRegistryConfigurator.initEventRegistryEngine(
syncope_1          |            at org.flowable.eventregistry.spring.configurator.SpringEventRegistryConfigurator.configure(
syncope_1          |            at org.flowable.common.engine.impl.AbstractEngineConfiguration.configuratorsAfterInit(
syncope_1          |            at org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl.init(
syncope_1          |            at org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl.buildProcessEngine(
syncope_1          |            at org.flowable.spring.SpringProcessEngineConfiguration.buildProcessEngine(

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.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: