Exception while closing command context NullPointerException

Hi,
I’m getting some errors while executing a batch with Camunda:

16:50:26.825 [pool-1-thread-2] DEBUG org.camunda.bpm.engine.impl.persistence.entity.JobEntity.deleteMessage - ==> Parameters: 63722(String), 2(Integer)
16:50:26.825 [JobExecutor[org.camunda.bpm.engine.impl.jobexecutor.DefaultJobExecutor]] DEBUG org.camunda.bpm.engine.impl.persistence.entity.JobEntity.updateAcquirableJob - ==>  Preparing: update ACT_RU_JOB SET REV_ = ?, LOCK_EXP_TIME_ = ?, LOCK_OWNER_ = ?, DUEDATE_ = ?, PROCESS_INSTANCE_ID_ = ?, EXCLUSIVE_ = ? where ID_= ? and REV_ = ? 
16:50:26.825 [pool-1-thread-3] ERROR org.camunda.bpm.engine.context - ENGINE-16004 Exception while closing command context: null
java.lang.NullPointerException: null
at org.camunda.bpm.engine.impl.persistence.entity.JobEntity.getJobHandlerConfiguration(JobEntity.java:438)
at org.camunda.bpm.engine.impl.persistence.entity.JobEntity.execute(JobEntity.java:131)
at org.camunda.bpm.engine.impl.cmd.ExecuteJobsCmd.execute(ExecuteJobsCmd.java:110)
at org.camunda.bpm.engine.impl.cmd.ExecuteJobsCmd.execute(ExecuteJobsCmd.java:43)
at org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:28)
at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:110)
at org.camunda.bpm.engine.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:46)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)
at org.camunda.bpm.engine.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:44)
at org.camunda.bpm.engine.impl.interceptor.ProcessApplicationContextInterceptor.execute(ProcessApplicationContextInterceptor.java:70)
at org.camunda.bpm.engine.impl.interceptor.CommandCounterInterceptor.execute(CommandCounterInterceptor.java:35)
at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
at org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobHelper.executeJob(ExecuteJobHelper.java:57)
at org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobsRunnable.executeJob(ExecuteJobsRunnable.java:110)
at org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobsRunnable.run(ExecuteJobsRunnable.java:71)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
16:50:26.826 [JobExecutor[org.camunda.bpm.engine.impl.jobexecutor.DefaultJobExecutor]] DEBUG org.camunda.bpm.engine.impl.persistence.entity.JobEntity.updateAcquirableJob - ==> Parameters: 2(Integer), 2021-02-10 16:55:26.825(Timestamp), 33669df8-c15a-4130-9018-4256d7dcd017(String), 2021-02-10 16:38:31.704(Timestamp), null, true(Boolean), 63748(String), 1(Integer)
16:50:26.826 [pool-1-thread-3] DEBUG org.springframework.jdbc.datasource.DataSourceTransactionManager - Participating in existing transaction
16:50:26.826 [pool-1-thread-3] DEBUG org.apache.ibatis.transaction.managed.ManagedTransaction - Closing JDBC Connection [Transaction-aware proxy for target Connection [HikariProxyConnection@1714965321 wrapping org.postgresql.jdbc.PgConnection@45841097]]
16:50:26.826 [pool-1-thread-3] DEBUG org.springframework.transaction.support.TransactionTemplate - Initiating transaction rollback on application exception
java.lang.NullPointerException: null
at org.camunda.bpm.engine.impl.persistence.entity.JobEntity.getJobHandlerConfiguration(JobEntity.java:438)
at org.camunda.bpm.engine.impl.persistence.entity.JobEntity.execute(JobEntity.java:131)
at org.camunda.bpm.engine.impl.cmd.ExecuteJobsCmd.execute(ExecuteJobsCmd.java:110)
at org.camunda.bpm.engine.impl.cmd.ExecuteJobsCmd.execute(ExecuteJobsCmd.java:43)
at org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:28)
at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:110)
at org.camunda.bpm.engine.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:46)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)
at org.camunda.bpm.engine.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:44)
at org.camunda.bpm.engine.impl.interceptor.ProcessApplicationContextInterceptor.execute(ProcessApplicationContextInterceptor.java:70)
at org.camunda.bpm.engine.impl.interceptor.CommandCounterInterceptor.execute(CommandCounterInterceptor.java:35)
at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
at org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobHelper.executeJob(ExecuteJobHelper.java:57)
at org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobsRunnable.executeJob(ExecuteJobsRunnable.java:110)
at org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobsRunnable.run(ExecuteJobsRunnable.java:71)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
16:50:26.826 [pool-1-thread-3] DEBUG org.springframework.jdbc.datasource.DataSourceTransactionManager - Initiating transaction rollback
16:50:26.826 [JobExecutor[org.camunda.bpm.engine.impl.jobexecutor.DefaultJobExecutor]] DEBUG org.apache.ibatis.transaction.managed.ManagedTransaction - Closing JDBC Connection [Transaction-aware proxy for target Connection [HikariProxyConnection@930431984 wrapping org.postgresql.jdbc.PgConnection@868643]]
16:50:26.826 [pool-1-thread-3] DEBUG org.springframework.jdbc.datasource.DataSourceTransactionManager - Rolling back JDBC transaction on Connection [HikariProxyConnection@1714965321 wrapping org.postgresql.jdbc.PgConnection@45841097]

at the same log I see the following:

16:50:27.995 [pool-1-thread-2] ERROR org.camunda.bpm.engine.context - ENGINE-16004 Exception while closing command context: pgStatement.getConnection().getAutoCommit() should not throw
java.lang.AssertionError: pgStatement.getConnection().getAutoCommit() should not throw
at org.postgresql.jdbc.BatchResultHandler.isAutoCommit(BatchResultHandler.java:105)
at org.postgresql.jdbc.BatchResultHandler.handleCompletion(BatchResultHandler.java:161)
at org.postgresql.jdbc.PgStatement.executeBatch(PgStatement.java:778)
at org.postgresql.jdbc.PgPreparedStatement.executeBatch(PgPreparedStatement.java:1563)
at com.zaxxer.hikari.pool.ProxyStatement.executeBatch(ProxyStatement.java:128)
at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeBatch(HikariProxyPreparedStatement.java)
at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.ibatis.logging.jdbc.PreparedStatementLogger.invoke(PreparedStatementLogger.java:78)
at com.sun.proxy.$Proxy30.executeBatch(Unknown Source)
at org.apache.ibatis.executor.BatchExecutor.doFlushStatements(BatchExecutor.java:123)
at org.apache.ibatis.executor.BaseExecutor.flushStatements(BaseExecutor.java:129)
at org.apache.ibatis.executor.BaseExecutor.flushStatements(BaseExecutor.java:122)
at org.apache.ibatis.executor.CachingExecutor.flushStatements(CachingExecutor.java:114)
at org.apache.ibatis.session.defaults.DefaultSqlSession.flushStatements(DefaultSqlSession.java:252)
at org.camunda.bpm.engine.impl.db.sql.DbSqlSession.flushBatchOperations(DbSqlSession.java:411)
at org.camunda.bpm.engine.impl.db.sql.BatchDbSqlSession.executeDbOperations(BatchDbSqlSession.java:74)
at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flushDbOperations(DbEntityManager.java:341)
at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flushDbOperationManager(DbEntityManager.java:323)
at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flush(DbEntityManager.java:295)
at org.camunda.bpm.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:272)
at org.camunda.bpm.engine.impl.interceptor.CommandContext.close(CommandContext.java:188)
at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:119)
at org.camunda.bpm.engine.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:46)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)
at org.camunda.bpm.engine.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:44)
at org.camunda.bpm.engine.impl.interceptor.ProcessApplicationContextInterceptor.execute(ProcessApplicationContextInterceptor.java:70)
at org.camunda.bpm.engine.impl.interceptor.CommandCounterInterceptor.execute(CommandCounterInterceptor.java:35)
at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
at org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobHelper.executeJob(ExecuteJobHelper.java:57)
at org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobsRunnable.executeJob(ExecuteJobsRunnable.java:110)
at org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobsRunnable.run(ExecuteJobsRunnable.java:71)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
16:50:27.995 [pool-1-thread-2] DEBUG org.springframework.jdbc.datasource.DataSourceTransactionManager - Participating in existing transaction
16:50:27.996 [pool-1-thread-2] DEBUG org.apache.ibatis.transaction.managed.ManagedTransaction - Closing JDBC Connection [Transaction-aware proxy for target Connection [HikariProxyConnection@1662763569 wrapping org.postgresql.jdbc.PgConnection@4f7c7be7]]
16:50:27.996 [pool-1-thread-2] DEBUG org.springframework.transaction.support.TransactionTemplate - Initiating transaction rollback on application exception
java.lang.AssertionError: pgStatement.getConnection().getAutoCommit() should not throw
at org.postgresql.jdbc.BatchResultHandler.isAutoCommit(BatchResultHandler.java:105)
at org.postgresql.jdbc.BatchResultHandler.handleCompletion(BatchResultHandler.java:161)
at org.postgresql.jdbc.PgStatement.executeBatch(PgStatement.java:778)
at org.postgresql.jdbc.PgPreparedStatement.executeBatch(PgPreparedStatement.java:1563)
at com.zaxxer.hikari.pool.ProxyStatement.executeBatch(ProxyStatement.java:128)
at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeBatch(HikariProxyPreparedStatement.java)
at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.ibatis.logging.jdbc.PreparedStatementLogger.invoke(PreparedStatementLogger.java:78)
at com.sun.proxy.$Proxy30.executeBatch(Unknown Source)
at org.apache.ibatis.executor.BatchExecutor.doFlushStatements(BatchExecutor.java:123)
at org.apache.ibatis.executor.BaseExecutor.flushStatements(BaseExecutor.java:129)
at org.apache.ibatis.executor.BaseExecutor.flushStatements(BaseExecutor.java:122)
at org.apache.ibatis.executor.CachingExecutor.flushStatements(CachingExecutor.java:114)
at org.apache.ibatis.session.defaults.DefaultSqlSession.flushStatements(DefaultSqlSession.java:252)
at org.camunda.bpm.engine.impl.db.sql.DbSqlSession.flushBatchOperations(DbSqlSession.java:411)
at org.camunda.bpm.engine.impl.db.sql.BatchDbSqlSession.executeDbOperations(BatchDbSqlSession.java:74)
at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flushDbOperations(DbEntityManager.java:341)
at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flushDbOperationManager(DbEntityManager.java:323)
at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flush(DbEntityManager.java:295)
at org.camunda.bpm.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:272)
at org.camunda.bpm.engine.impl.interceptor.CommandContext.close(CommandContext.java:188)
at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:119)
at org.camunda.bpm.engine.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:46)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)
at org.camunda.bpm.engine.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:44)
at org.camunda.bpm.engine.impl.interceptor.ProcessApplicationContextInterceptor.execute(ProcessApplicationContextInterceptor.java:70)
at org.camunda.bpm.engine.impl.interceptor.CommandCounterInterceptor.execute(CommandCounterInterceptor.java:35)
at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
at org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobHelper.executeJob(ExecuteJobHelper.java:57)
at org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobsRunnable.executeJob(ExecuteJobsRunnable.java:110)
at org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobsRunnable.run(ExecuteJobsRunnable.java:71)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
16:50:27.996 [pool-1-thread-2] DEBUG org.springframework.jdbc.datasource.DataSourceTransactionManager - Initiating transaction rollback
16:50:27.996 [pool-1-thread-2] DEBUG org.springframework.jdbc.datasource.DataSourceTransactionManager - Rolling back JDBC transaction on Connection [HikariProxyConnection@1662763569 wrapping org.postgresql.jdbc.PgConnection@4f7c7be7]
16:50:27.996 [pool-1-thread-2] WARN com.zaxxer.hikari.pool.ProxyConnection - fatca-camunda-pool - Connection org.postgresql.jdbc.PgConnection@4f7c7be7 marked as broken because of SQLSTATE(08003), ErrorCode(0)
org.postgresql.util.PSQLException: This connection has been closed.
at org.postgresql.jdbc.PgConnection.checkClosed(PgConnection.java:766)
at org.postgresql.jdbc.PgConnection.rollback(PgConnection.java:773)
at com.zaxxer.hikari.pool.ProxyConnection.rollback(ProxyConnection.java:370)
at com.zaxxer.hikari.pool.HikariProxyConnection.rollback(HikariProxyConnection.java)
at org.springframework.jdbc.datasource.DataSourceTransactionManager.doRollback(DataSourceTransactionManager.java:344)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.processRollback(AbstractPlatformTransactionManager.java:835)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.rollback(AbstractPlatformTransactionManager.java:809)
at org.springframework.transaction.support.TransactionTemplate.rollbackOnException(TransactionTemplate.java:168)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:144)
at org.camunda.bpm.engine.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:44)
at org.camunda.bpm.engine.impl.interceptor.ProcessApplicationContextInterceptor.execute(ProcessApplicationContextInterceptor.java:70)
at org.camunda.bpm.engine.impl.interceptor.CommandCounterInterceptor.execute(CommandCounterInterceptor.java:35)
at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
at org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobHelper.executeJob(ExecuteJobHelper.java:57)
at org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobsRunnable.executeJob(ExecuteJobsRunnable.java:110)
at org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobsRunnable.run(ExecuteJobsRunnable.java:71)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
16:50:27.996 [pool-1-thread-2] DEBUG org.springframework.jdbc.datasource.DataSourceTransactionManager - Could not reset JDBC Connection after transaction
java.sql.SQLException: Connection is closed
at com.zaxxer.hikari.pool.ProxyConnection$ClosedConnection.lambda$getClosedConnection$0(ProxyConnection.java:489)
at com.sun.proxy.$Proxy29.setAutoCommit(Unknown Source)
at com.zaxxer.hikari.pool.ProxyConnection.setAutoCommit(ProxyConnection.java:388)
at com.zaxxer.hikari.pool.HikariProxyConnection.setAutoCommit(HikariProxyConnection.java)
at org.springframework.jdbc.datasource.DataSourceTransactionManager.doCleanupAfterCompletion(DataSourceTransactionManager.java:374)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.cleanupAfterCompletion(AbstractPlatformTransactionManager.java:1004)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.processRollback(AbstractPlatformTransactionManager.java:875)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.rollback(AbstractPlatformTransactionManager.java:809)
at org.springframework.transaction.support.TransactionTemplate.rollbackOnException(TransactionTemplate.java:168)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:144)
at org.camunda.bpm.engine.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:44)
at org.camunda.bpm.engine.impl.interceptor.ProcessApplicationContextInterceptor.execute(ProcessApplicationContextInterceptor.java:70)
at org.camunda.bpm.engine.impl.interceptor.CommandCounterInterceptor.execute(CommandCounterInterceptor.java:35)
at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
at org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobHelper.executeJob(ExecuteJobHelper.java:57)
at org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobsRunnable.executeJob(ExecuteJobsRunnable.java:110)
at org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobsRunnable.run(ExecuteJobsRunnable.java:71)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
16:50:27.996 [pool-1-thread-2] DEBUG org.springframework.jdbc.datasource.DataSourceTransactionManager - Releasing JDBC Connection [HikariProxyConnection@1662763569 wrapping com.zaxxer.hikari.pool.ProxyConnection.ClosedConnection] after transaction
16:50:27.996 [pool-1-thread-2] ERROR org.springframework.transaction.support.TransactionTemplate - Application exception overridden by rollback exception
java.lang.AssertionError: pgStatement.getConnection().getAutoCommit() should not throw
at org.postgresql.jdbc.BatchResultHandler.isAutoCommit(BatchResultHandler.java:105)
at org.postgresql.jdbc.BatchResultHandler.handleCompletion(BatchResultHandler.java:161)
at org.postgresql.jdbc.PgStatement.executeBatch(PgStatement.java:778)
at org.postgresql.jdbc.PgPreparedStatement.executeBatch(PgPreparedStatement.java:1563)
at com.zaxxer.hikari.pool.ProxyStatement.executeBatch(ProxyStatement.java:128)
at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeBatch(HikariProxyPreparedStatement.java)
at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.ibatis.logging.jdbc.PreparedStatementLogger.invoke(PreparedStatementLogger.java:78)
at com.sun.proxy.$Proxy30.executeBatch(Unknown Source)
at org.apache.ibatis.executor.BatchExecutor.doFlushStatements(BatchExecutor.java:123)
at org.apache.ibatis.executor.BaseExecutor.flushStatements(BaseExecutor.java:129)
at org.apache.ibatis.executor.BaseExecutor.flushStatements(BaseExecutor.java:122)
at org.apache.ibatis.executor.CachingExecutor.flushStatements(CachingExecutor.java:114)
at org.apache.ibatis.session.defaults.DefaultSqlSession.flushStatements(DefaultSqlSession.java:252)
at org.camunda.bpm.engine.impl.db.sql.DbSqlSession.flushBatchOperations(DbSqlSession.java:411)
at org.camunda.bpm.engine.impl.db.sql.BatchDbSqlSession.executeDbOperations(BatchDbSqlSession.java:74)
at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flushDbOperations(DbEntityManager.java:341)
at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flushDbOperationManager(DbEntityManager.java:323)
at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flush(DbEntityManager.java:295)
at org.camunda.bpm.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:272)
at org.camunda.bpm.engine.impl.interceptor.CommandContext.close(CommandContext.java:188)
at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:119)
at org.camunda.bpm.engine.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:46)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)
at org.camunda.bpm.engine.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:44)
at org.camunda.bpm.engine.impl.interceptor.ProcessApplicationContextInterceptor.execute(ProcessApplicationContextInterceptor.java:70)
at org.camunda.bpm.engine.impl.interceptor.CommandCounterInterceptor.execute(CommandCounterInterceptor.java:35)
at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
at org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobHelper.executeJob(ExecuteJobHelper.java:57)
at org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobsRunnable.executeJob(ExecuteJobsRunnable.java:110)
at org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobsRunnable.run(ExecuteJobsRunnable.java:71)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
16:50:27.996 [pool-1-thread-2] DEBUG org.camunda.bpm.engine.cmd - ENGINE-13006 Finishing command -------------------- ExecuteJobsCmd ----------------------
16:50:27.996 [pool-1-thread-2] DEBUG org.camunda.bpm.engine.cmd - ENGINE-13005 Starting command -------------------- FailedJobListener ----------------------
16:50:27.996 [pool-1-thread-2] DEBUG org.springframework.jdbc.datasource.DataSourceTransactionManager - Creating new transaction with name [null]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT
16:50:27.996 [pool-1-thread-2] DEBUG org.camunda.bpm.engine.cmd - ENGINE-13006 Finishing command -------------------- FailedJobListener ----------------------
16:50:27.997 [pool-1-thread-2] WARN org.camunda.bpm.engine.jobexecutor - ENGINE-14006 Exception while executing job 64329: 
org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is java.sql.SQLException: HikariDataSource HikariDataSource (fatca-camunda-pool) has been closed.
at org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:305)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.startTransaction(AbstractPlatformTransactionManager.java:400)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:373)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:137)
at org.camunda.bpm.engine.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:44)
at org.camunda.bpm.engine.impl.interceptor.ProcessApplicationContextInterceptor.execute(ProcessApplicationContextInterceptor.java:70)
at org.camunda.bpm.engine.impl.interceptor.CommandCounterInterceptor.execute(CommandCounterInterceptor.java:35)
at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
at org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobHelper.callFailedJobListenerWithRetries(ExecuteJobHelper.java:113)
at org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobHelper.invokeJobListener(ExecuteJobHelper.java:94)
at org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobHelper.executeJob(ExecuteJobHelper.java:75)
at org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobsRunnable.executeJob(ExecuteJobsRunnable.java:110)
at org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobsRunnable.run(ExecuteJobsRunnable.java:71)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.sql.SQLException: HikariDataSource HikariDataSource (fatca-camunda-pool) has been closed.
at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:96)
at org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:261)
... 15 common frames omitted​

I would like to know what throw this exception.

Camunda version: 7.14 and I created my own Spring Process Engine Configuration

Thanks in advance!

Juan.

Hi, @tmetzke
I guess the configuration is ok, I don’t if missing something look the following:

@Bean(name = "fatca-camunda-ds")
public HikariDataSource dataSource() {

HikariConfig hikariConfig = new HikariConfig();

hikariConfig.setJdbcUrl(dbURL);
hikariConfig.setUsername(dbUsername);
hikariConfig.setPassword(dbPassword);

hikariConfig.setPoolName("fatca-camunda-pool");
hikariConfig.setMaximumPoolSize(50);

hikariConfig.setDriverClassName(dbDriver);
hikariConfig.addDataSourceProperty("cachePrepStmts", "true");
hikariConfig.addDataSourceProperty("prepStmtCacheSize", "250");
hikariConfig.addDataSourceProperty("prepStmtCacheSqlLimit", "2048");

HikariDataSource dataSource = new HikariDataSource(hikariConfig);

return dataSource;
}

@Bean(name = "fatcaCamundaTransactionManager")
public PlatformTransactionManager secondaryTransactionManager(
@Qualifier("fatca-camunda-ds") final DataSource dataSource) {

DataSourceTransactionManager tm = new DataSourceTransactionManager(dataSource);

return tm;
}

@Bean(name = "fatcaCalculationJobHandler")
public CalculationBatchJobHandler simpleCustomCalculationBatchJobHandler() {

return new CalculationBatchJobHandler();
}

@Bean("fatcaCustomCalculationBatchJobHandler")
public ProcessEnginePlugin customCalculationBatchJobHandler(
@Qualifier("fatcaCalculationJobHandler") final CalculationBatchJobHandler calculationBatchJobHandler) {

return new CustomBatchHandlerPlugin(calculationBatchJobHandler);
}

@Bean(name = "fatcaProcessEngineConfiguration")
public SpringProcessEngineConfiguration processEngineConfiguration(
@Qualifier("fatcaCamundaTransactionManager") final PlatformTransactionManager ptm,
@Qualifier("fatca-camunda-ds") final DataSource dataSource) {

SpringProcessEngineConfiguration springProcessEngineConfiguration = new SpringProcessEngineConfiguration();

springProcessEngineConfiguration.setApplicationContext(applicationContext);
springProcessEngineConfiguration.setDataSource(dataSource);
springProcessEngineConfiguration.setTransactionManager(ptm);

springProcessEngineConfiguration.setDeployChangedOnly(deployChangedOnly); // true
springProcessEngineConfiguration.setJobExecutorActivate(jobExecution); // true
springProcessEngineConfiguration.setMetricsEnabled(metricsEnabled); // false
springProcessEngineConfiguration.setDbMetricsReporterActivate(metricsDbReporterActivate); // false
springProcessEngineConfiguration.setBatchJobsPerSeed(batchJobsPerSeed); // 20
springProcessEngineConfiguration.setInvocationsPerBatchJob(invocationsPerBatchJob); // 5
springProcessEngineConfiguration.setDatabaseType(databaseType); // postgres
springProcessEngineConfiguration.setDatabaseSchemaUpdate(databaseSchemaUpdate); // true
springProcessEngineConfiguration.setJdbcBatchProcessing(jdbcBatchProcessing); // true
springProcessEngineConfiguration.setJdbcMaxActiveConnections(6000);
springProcessEngineConfiguration.setHistory(historyLevel); // full

Map<Object, Object> beans = new HashMap<>();

beans.put("individualService", individualService);
beans.put("entityService", entityService);
beans.put("controllingPersonService", controllingPersonService);
beans.put("documentService", documentService);
beans.put("reasonAccountHoldersService", reasonAccountHoldersService);

beans.put("isIndividualBalanceOverThresholdPreexistingAccount",
isIndividualBalanceOverThresholdPreexistingAccount);
beans.put("isIndividualLowerValue", isIndividualLowerValue);
beans.put("isPreexistingAccount", isPreexistingAccount);
beans.put("isIndividualBalanceOverThresholdNewAccount", isIndividualBalanceOverThresholdNewAccount);
beans.put("isBalanceOverThresholdEntityPreexistingAccount", isBalanceOverThresholdEntityPreexistingAccount);

beans.put("isControllingPersonBalanceOverThresholdPreexistingAccount",
isControllingPersonBalanceOverThresholdPreexistingAccount);

springProcessEngineConfiguration.setBeans(beans);

return springProcessEngineConfiguration;
}

@Bean(name = "fatcaProcessEngineFactoryBean")
public ProcessEngineFactoryBean processEngineFactoryBean(
@Qualifier("fatcaProcessEngineConfiguration") final SpringProcessEngineConfiguration springProcessEngineConfiguration) {

ProcessEngineFactoryBean p = new ProcessEngineFactoryBean();

p.setProcessEngineConfiguration(springProcessEngineConfiguration);

return p;
}

@Bean(name = "fatcaRuntimeService")
public RuntimeService runtimeService(
@Qualifier("fatcaProcessEngineFactoryBean") final ProcessEngineFactoryBean processEngineFactoryBean) {

return processEngineFactoryBean.getProcessEngineConfiguration().getRuntimeService();
}​

Can you help if I doing something wrong?

Thank you so much!

Juan.

Hey @jppazmin,

on first sight, the configuration itself looks OK with regards to the datasource and transaction manager being set in engine configuration. I have never actually used the SpringProcessEngineConfiguration as the marker to be implemented by a bean in such a case but rather the CamundaProcessEngineConfiguration but it should be fine as the log also indicated that the datasource is used by the engine. I might however be mistaken here.

The log however also reveals that the datasource has been closed in between, which I do not really get to be honest:

I am not an expert on this specific topic to be honest, so maybe someone else has an idea as to why this happens or you have an idea yourself why the datasource has been closed.

Sorry to not be of much more help here.

Best,
Tobias

Hi @tmetzke,

Thank you very much for your help!, please let me know if you find something that can help me for this issue, I’ll posted if I find the solution.

Cheers,

Juan.

Hi @nikola.koevski and @Niall ,

I trying to find the solution the subject error and I execute the process with oracle database and I got the following:

camundaLogError.log (84.7 KB)

Do you know why this type of error is being generated?
I’m using camunda 7.14, Oracle 12 and Postgres 12 database, Camunda Batch extension and I do the own springProcessEngineConfiguration.

Hope you can help me with this issue.

Thanks in advance.

Juan.

Hi @jppazmin,

Thanks for the logs. Can you tell me what JDK and Oracle JDBC versions you’re using? I’ve seen similar errors when the versions of the Oracle DB and JDBC drivers mismatch. You can find the compatibility matrix here: Oracle JDBC Frequently Asked Questions (under What are the Oracle JDBC releases Vs JDK versions?).

Best,
Nikola

Hi @nikola.koevski,
Sure, I’m using the following:

JDK: 1.8.0_261
Database: Oracle 12.2.0.1.0
JDBC Version: ojdbc8-12.2.0.1.jar

I saw the compatibility matrix and I think that is ok, what do you think ?

Cheers,
Juan.

@jppazmin the combination looks good, no issue there.

I noticed this part of the logs:

I think this might be related to Hikari. Depending on how it is configured, it might be enabling the auto-commit option on transactions. The process engine uses an optimistic locking mechanism to deal with concurrent transactions/errors, and for it to work, auto-commit must be disabled. Can you confirm that it is disabled?

Best,
Nikola

Hi @nikola.koevski,

I already added the following line in my configuration:

hikariConfig.setAutoCommit(false);

But I get the same result, it has a strange behavior, sometimes the connection close good and sometimes no, in both cases with or without the line above it has the same behavior, it’s like the SpringContextShutdownHook close the Hikari connection before the Camunda engine is finished, it’s I can see in this behavior. Will exist a way to synchronize it?

Cheers,
Juan.

@jppazmin, can you try to disable auto-commit via the JDBC URL parameter and see if this works?

Alternatively, if you can consistently reproduce the problem, please describe the steps so I can try it on my side.

Best,
Nikola