ENGINE-03004 Exception while executing Database Operation

Hello everyone,

i get the following error:

org.camunda.bpm.engine.ProcessEngineException: ENGINE-03004 Exception while executing Database Operation ‘INSERT TaskEntity[15]’ with message ’

Error updating database. Cause: org.h2.jdbc.JdbcSQLException: Referential integrity constraint violation: “ACT_FK_TASK_CASE_EXE: PUBLIC.ACT_RU_TASK FOREIGN KEY(CASE_EXECUTION_ID_) REFERENCES PUBLIC.ACT_RU_CASE_EXECUTION(ID_) (‘11’)”; SQL statement:

insert into ACT_RU_TASK (
ID_,
NAME_,
PARENT_TASK_ID_,
DESCRIPTION_,
PRIORITY_,
CREATE_TIME_,
OWNER_,
ASSIGNEE_,
DELEGATION_,
EXECUTION_ID_,
PROC_INST_ID_,
PROC_DEF_ID_,
CASE_EXECUTION_ID_,
CASE_INST_ID_,
CASE_DEF_ID_,
TASK_DEF_KEY_,
DUE_DATE_,
FOLLOW_UP_DATE_,
SUSPENSION_STATE_,
TENANT_ID_,
REV_
) values (
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
1
) [23506-193]

The error may involve org.camunda.bpm.engine.impl.persistence.entity.TaskEntity.insertTask-Inline

The error occurred while setting parameters

SQL: insert into ACT_RU_TASK ( ID_, NAME_, PARENT_TASK_ID_, DESCRIPTION_, PRIORITY_, CREATE_TIME_, OWNER_, ASSIGNEE_, DELEGATION_, EXECUTION_ID_, PROC_INST_ID_, PROC_DEF_ID_, CASE_EXECUTION_ID_, CASE_INST_ID_, CASE_DEF_ID_, TASK_DEF_KEY_, DUE_DATE_, FOLLOW_UP_DATE_, SUSPENSION_STATE_, TENANT_ID_, REV_ ) values ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 1 )

Cause: org.h2.jdbc.JdbcSQLException: Referential integrity constraint violation: “ACT_FK_TASK_CASE_EXE: PUBLIC.ACT_RU_TASK FOREIGN KEY(CASE_EXECUTION_ID_) REFERENCES PUBLIC.ACT_RU_CASE_EXECUTION(ID_) (‘11’)”; SQL statement:

insert into ACT_RU_TASK (
ID_,
NAME_,
PARENT_TASK_ID_,
DESCRIPTION_,
PRIORITY_,
CREATE_TIME_,
OWNER_,
ASSIGNEE_,
DELEGATION_,
EXECUTION_ID_,
PROC_INST_ID_,
PROC_DEF_ID_,
CASE_EXECUTION_ID_,
CASE_INST_ID_,
CASE_DEF_ID_,
TASK_DEF_KEY_,
DUE_DATE_,
FOLLOW_UP_DATE_,
SUSPENSION_STATE_,
TENANT_ID_,
REV_
) values (
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
1
) [23506-193]’. Flush summary:
[
INSERT HistoricTaskInstanceEventEntity[15]
INSERT HistoricTaskInstanceEventEntity[18]
INSERT HistoricCaseInstanceEventEntity[8]
INSERT HistoricCaseActivityInstanceEventEntity[10]
INSERT HistoricCaseActivityInstanceEventEntity[11]
INSERT HistoricCaseActivityInstanceEventEntity[16]
INSERT HistoricCaseActivityInstanceEventEntity[17]
INSERT HistoricCaseActivityInstanceEventEntity[9]
INSERT CaseExecutionEntity[8]
INSERT CaseExecutionEntity[10]
INSERT CaseExecutionEntity[17]
INSERT CaseExecutionEntity[16]
INSERT TaskEntity[15]
INSERT TaskEntity[18]
INSERT CaseSentryPartEntity[12]
INSERT CaseSentryPartEntity[13]
INSERT CaseSentryPartEntity[14]
]
at org.camunda.bpm.engine.impl.db.EnginePersistenceLogger.flushDbOperationException(EnginePersistenceLogger.java:115)
at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flushDbOperationManager(DbEntityManager.java:292)
at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flush(DbEntityManager.java:278)
at org.camunda.bpm.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:247)
at org.camunda.bpm.engine.impl.interceptor.CommandContext.close(CommandContext.java:176)
at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:113)
at org.camunda.bpm.engine.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:42)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
at org.camunda.bpm.engine.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:40)
at org.camunda.bpm.engine.impl.interceptor.ProcessApplicationContextInterceptor.execute(ProcessApplicationContextInterceptor.java:66)
at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:30)
at org.camunda.bpm.engine.impl.cmmn.CaseInstanceBuilderImpl.create(CaseInstanceBuilderImpl.java:117)
at org.camunda.bpm.engine.impl.cmmn.CaseServiceImpl.createCaseInstanceByKey(CaseServiceImpl.java:201)
at org.educama.shipment.casemodel.ShipmentCaseModelTest.testCaseAfterCreation(ShipmentCaseModelTest.java:172)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)
at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
at org.camunda.bpm.engine.test.ProcessEngineRule$1.evaluate(ProcessEngineRule.java:165)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:252)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:94)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:191)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: org.apache.ibatis.exceptions.PersistenceException:

Error updating database. Cause: org.h2.jdbc.JdbcSQLException: Referential integrity constraint violation: “ACT_FK_TASK_CASE_EXE: PUBLIC.ACT_RU_TASK FOREIGN KEY(CASE_EXECUTION_ID_) REFERENCES PUBLIC.ACT_RU_CASE_EXECUTION(ID_) (‘11’)”; SQL statement:

insert into ACT_RU_TASK (
ID_,
NAME_,
PARENT_TASK_ID_,
DESCRIPTION_,
PRIORITY_,
CREATE_TIME_,
OWNER_,
ASSIGNEE_,
DELEGATION_,
EXECUTION_ID_,
PROC_INST_ID_,
PROC_DEF_ID_,
CASE_EXECUTION_ID_,
CASE_INST_ID_,
CASE_DEF_ID_,
TASK_DEF_KEY_,
DUE_DATE_,
FOLLOW_UP_DATE_,
SUSPENSION_STATE_,
TENANT_ID_,
REV_
) values (
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
1
) [23506-193]

The error may involve org.camunda.bpm.engine.impl.persistence.entity.TaskEntity.insertTask-Inline

The error occurred while setting parameters

SQL: insert into ACT_RU_TASK ( ID_, NAME_, PARENT_TASK_ID_, DESCRIPTION_, PRIORITY_, CREATE_TIME_, OWNER_, ASSIGNEE_, DELEGATION_, EXECUTION_ID_, PROC_INST_ID_, PROC_DEF_ID_, CASE_EXECUTION_ID_, CASE_INST_ID_, CASE_DEF_ID_, TASK_DEF_KEY_, DUE_DATE_, FOLLOW_UP_DATE_, SUSPENSION_STATE_, TENANT_ID_, REV_ ) values ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 1 )

Cause: org.h2.jdbc.JdbcSQLException: Referential integrity constraint violation: “ACT_FK_TASK_CASE_EXE: PUBLIC.ACT_RU_TASK FOREIGN KEY(CASE_EXECUTION_ID_) REFERENCES PUBLIC.ACT_RU_CASE_EXECUTION(ID_) (‘11’)”; SQL statement:

insert into ACT_RU_TASK (
ID_,
NAME_,
PARENT_TASK_ID_,
DESCRIPTION_,
PRIORITY_,
CREATE_TIME_,
OWNER_,
ASSIGNEE_,
DELEGATION_,
EXECUTION_ID_,
PROC_INST_ID_,
PROC_DEF_ID_,
CASE_EXECUTION_ID_,
CASE_INST_ID_,
CASE_DEF_ID_,
TASK_DEF_KEY_,
DUE_DATE_,
FOLLOW_UP_DATE_,
SUSPENSION_STATE_,
TENANT_ID_,
REV_
) values (
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
1
) [23506-193]
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:26)
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:154)
at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:141)
at org.camunda.bpm.engine.impl.db.sql.DbSqlSession.executeInsertEntity(DbSqlSession.java:145)
at org.camunda.bpm.engine.impl.db.sql.DbSqlSession.insertEntity(DbSqlSession.java:137)
at org.camunda.bpm.engine.impl.db.AbstractPersistenceSession.executeDbOperation(AbstractPersistenceSession.java:41)
at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flushDbOperationManager(DbEntityManager.java:289)
… 46 more
Caused by: org.h2.jdbc.JdbcSQLException: Referential integrity constraint violation: “ACT_FK_TASK_CASE_EXE: PUBLIC.ACT_RU_TASK FOREIGN KEY(CASE_EXECUTION_ID_) REFERENCES PUBLIC.ACT_RU_CASE_EXECUTION(ID_) (‘11’)”; SQL statement:
insert into ACT_RU_TASK (
ID_,
NAME_,
PARENT_TASK_ID_,
DESCRIPTION_,
PRIORITY_,
CREATE_TIME_,
OWNER_,
ASSIGNEE_,
DELEGATION_,
EXECUTION_ID_,
PROC_INST_ID_,
PROC_DEF_ID_,
CASE_EXECUTION_ID_,
CASE_INST_ID_,
CASE_DEF_ID_,
TASK_DEF_KEY_,
DUE_DATE_,
FOLLOW_UP_DATE_,
SUSPENSION_STATE_,
TENANT_ID_,
REV_
) values (
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
1
) [23506-193]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
at org.h2.message.DbException.get(DbException.java:179)
at org.h2.message.DbException.get(DbException.java:155)
at org.h2.constraint.ConstraintReferential.checkRowOwnTable(ConstraintReferential.java:372)
at org.h2.constraint.ConstraintReferential.checkRow(ConstraintReferential.java:314)
at org.h2.table.Table.fireConstraints(Table.java:967)
at org.h2.table.Table.fireAfterRow(Table.java:985)
at org.h2.command.dml.Insert.insertRows(Insert.java:161)
at org.h2.command.dml.Insert.update(Insert.java:114)
at org.h2.command.CommandContainer.update(CommandContainer.java:98)
at org.h2.command.Command.executeUpdate(Command.java:258)
at org.h2.jdbc.JdbcPreparedStatement.execute(JdbcPreparedStatement.java:201)
at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:44)
at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:69)
at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:48)
at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:105)
at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:71)
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:152)
… 51 more

org.camunda.bpm.engine.exception.NotValidException: caseExecutionId is null
at org.camunda.bpm.engine.impl.cmmn.CaseExecutionCommandBuilderImpl.executeCommand(CaseExecutionCommandBuilderImpl.java:236)
at org.camunda.bpm.engine.impl.cmmn.CaseExecutionCommandBuilderImpl.terminate(CaseExecutionCommandBuilderImpl.java:224)
at org.camunda.bpm.engine.impl.cmmn.CaseServiceImpl.terminateCaseExecution(CaseServiceImpl.java:267)
at org.educama.shipment.casemodel.ShipmentCaseModelTest.cleanup(ShipmentCaseModelTest.java:82)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:33)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)
at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
at org.camunda.bpm.engine.test.ProcessEngineRule$1.evaluate(ProcessEngineRule.java:165)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:252)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:94)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:191)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: org.camunda.bpm.engine.exception.NullValueException: caseExecutionId is null
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.camunda.bpm.engine.impl.util.EnsureUtil.generateException(EnsureUtil.java:334)
at org.camunda.bpm.engine.impl.util.EnsureUtil.ensureNotNull(EnsureUtil.java:49)
at org.camunda.bpm.engine.impl.util.EnsureUtil.ensureNotNull(EnsureUtil.java:44)
at org.camunda.bpm.engine.impl.util.EnsureUtil.ensureNotNull(EnsureUtil.java:36)
at org.camunda.bpm.engine.impl.cmmn.cmd.CaseExecutionVariableCmd.execute(CaseExecutionVariableCmd.java:61)
at org.camunda.bpm.engine.impl.cmmn.cmd.StateTransitionCaseExecutionCmd.execute(StateTransitionCaseExecutionCmd.java:40)
at org.camunda.bpm.engine.impl.cmmn.cmd.StateTransitionCaseExecutionCmd.execute(StateTransitionCaseExecutionCmd.java:26)
at org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)
at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:104)
at org.camunda.bpm.engine.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:42)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
at org.camunda.bpm.engine.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:40)
at org.camunda.bpm.engine.impl.interceptor.ProcessApplicationContextInterceptor.execute(ProcessApplicationContextInterceptor.java:66)
at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:30)
at org.camunda.bpm.engine.impl.cmmn.CaseExecutionCommandBuilderImpl.executeCommand(CaseExecutionCommandBuilderImpl.java:230)
… 34 more

with this CMMN model:

My test full fills the condition of the entry criterion. How can i fix this problem?

Kind Regards,
Eberhard

Hi @eberhardheberm

so exception states caseExecutionId is null could you share your code on github may be?

Cheers,
Askar

Hi Askar,

of course. The github repo is located at: https://github.com/eberhardheber/Showcase/tree/master/backend and the failing test is available here: https://github.com/eberhardheber/Showcase/blob/master/backend/src/test/java/org/educama/shipment/casemodel/ShipmentCaseModelTest.java and the error is shown up on line 172 in the test “testCaseAfterCreation”.

Greetings,
Eberhard

Hi Askar,

short hint: If you add an sentry to the usertask “PlanItem_HumanTask_CompleteShipmentOrder” with the condition: “${shipmentOrderCompletedSentry.shipmentOrderCompleted(execution.getBusinessKey()) == false}” i don’t get this error.

Kind Regards,
Eberhard