cancel
Showing results for 
Search instead for 
Did you mean: 

'Integrity constraint violation' between CallActivities

gokceng1
Champ in-the-making
Champ in-the-making
Hi,
I have some complex process definition consisting of 12 call activities. You can find main process here.
The error stack is here:
5924 [main] ERROR org.activiti.engine.impl.interceptor.CommandContext  - Error while closing command context
org.apache.ibatis.exceptions.PersistenceException:
### Error updating database.  Cause: org.h2.jdbc.JdbcSQLException: Referential integrity constraint violation: "ACT_FK_EVENT_EXEC: PUBLIC.ACT_RU_EVENT_SUBSCR FOREIGN KEY(EXECUTION_ID_) REFERENCES PUBL
IC.ACT_RU_EXECUTION(ID_) ('307')"; SQL statement:
delete from ACT_RU_EXECUTION where ID_ = ? and REV_ = ? [23503-170]
   at org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
   at org.h2.message.DbException.get(DbException.java:169)
   at org.h2.message.DbException.get(DbException.java:146)
   at org.h2.constraint.ConstraintReferential.checkRow(ConstraintReferential.java:414)
   at org.h2.constraint.ConstraintReferential.checkRowRefTable(ConstraintReferential.java:431)
   at org.h2.constraint.ConstraintReferential.checkRow(ConstraintReferential.java:307)
   at org.h2.table.Table.fireConstraints(Table.java:870)
   at org.h2.table.Table.fireAfterRow(Table.java:887)
   at org.h2.command.dml.Delete.update(Delete.java:99)
   at org.h2.command.CommandContainer.update(CommandContainer.java:75)
   at org.h2.command.Command.executeUpdate(Command.java:230)
   at org.h2.server.TcpServerThread.process(TcpServerThread.java:333)
   at org.h2.server.TcpServerThread.run(TcpServerThread.java:149)
   at java.lang.Thread.run(Thread.java:722)

### The error may involve org.activiti.engine.impl.persistence.entity.ExecutionEntity.deleteExecution-Inline
### The error occurred while setting parameters
### SQL: delete from ACT_RU_EXECUTION where ID_ = ? and REV_ = ?
### Cause: org.h2.jdbc.JdbcSQLException: Referential integrity constraint violation: "ACT_FK_EVENT_EXEC: PUBLIC.ACT_RU_EVENT_SUBSCR FOREIGN KEY(EXECUTION_ID_) REFERENCES PUBLIC.ACT_RU_EXECUTION(ID_) (
'307')"; SQL statement:
delete from ACT_RU_EXECUTION where ID_ = ? and REV_ = ? [23503-170]
   at org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
   at org.h2.message.DbException.get(DbException.java:169)
   at org.h2.message.DbException.get(DbException.java:146)
   at org.h2.constraint.ConstraintReferential.checkRow(ConstraintReferential.java:414)
   at org.h2.constraint.ConstraintReferential.checkRowRefTable(ConstraintReferential.java:431)
   at org.h2.constraint.ConstraintReferential.checkRow(ConstraintReferential.java:307)
   at org.h2.table.Table.fireConstraints(Table.java:870)
   at org.h2.table.Table.fireAfterRow(Table.java:887)
   at org.h2.command.dml.Delete.update(Delete.java:99)
   at org.h2.command.CommandContainer.update(CommandContainer.java:75)
   at org.h2.command.Command.executeUpdate(Command.java:230)
   at org.h2.server.TcpServerThread.process(TcpServerThread.java:333)
   at org.h2.server.TcpServerThread.run(TcpServerThread.java:149)
   at java.lang.Thread.run(Thread.java:722)

   at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:23)
   at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:147)
   at org.apache.ibatis.session.defaults.DefaultSqlSession.delete(DefaultSqlSession.java:158)
   at org.activiti.engine.impl.db.DbSqlSession$DeletePersistentObjectOperation.execute(DbSqlSession.java:236)
   at org.activiti.engine.impl.db.DbSqlSession.flushDeletes(DbSqlSession.java:667)
   at org.activiti.engine.impl.db.DbSqlSession.flush(DbSqlSession.java:461)
   at org.activiti.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:167)
   at org.activiti.engine.impl.interceptor.CommandContext.close(CommandContext.java:114)
   at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:69)
   at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:42)
   at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)
   at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:40)
   at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:32)
   at org.activiti.engine.impl.RuntimeServiceImpl.signal(RuntimeServiceImpl.java:174)
   at org.activiti.designer.test.ProcessTestPstnCopperActivationProcess.shouldFailRetryAndContinue(ProcessTestPstnCopperActivationProcess.java:116)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:601)
   at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
   at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
   at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
   at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
   at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
   at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:83)
   at org.junit.rules.TestWatchman$1.evaluate(TestWatchman.java:48)
   at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
   at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
   at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
   at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
   at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
   at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
   at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
   at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
   at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
   at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
   at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
   at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
   at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)
   at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
   at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: org.h2.jdbc.JdbcSQLException: Referential integrity constraint violation: "ACT_FK_EVENT_EXEC: PUBLIC.ACT_RU_EVENT_SUBSCR FOREIGN KEY(EXECUTION_ID_) REFERENCES PUBLIC.ACT_RU_EXECUTION(ID_) (
'307')"; SQL statement:
delete from ACT_RU_EXECUTION where ID_ = ? and REV_ = ? [23503-170]
   at org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
   at org.h2.message.DbException.get(DbException.java:169)
   at org.h2.message.DbException.get(DbException.java:146)
   at org.h2.constraint.ConstraintReferential.checkRow(ConstraintReferential.java:414)
   at org.h2.constraint.ConstraintReferential.checkRowRefTable(ConstraintReferential.java:431)
   at org.h2.constraint.ConstraintReferential.checkRow(ConstraintReferential.java:307)
   at org.h2.table.Table.fireConstraints(Table.java:870)
   at org.h2.table.Table.fireAfterRow(Table.java:887)
   at org.h2.command.dml.Delete.update(Delete.java:99)
   at org.h2.command.CommandContainer.update(CommandContainer.java:75)
   at org.h2.command.Command.executeUpdate(Command.java:230)
   at org.h2.server.TcpServerThread.process(TcpServerThread.java:333)
   at org.h2.server.TcpServerThread.run(TcpServerThread.java:149)
   at java.lang.Thread.run(Thread.java:722)

   at org.h2.engine.SessionRemote.done(SessionRemote.java:505)
   at org.h2.command.CommandRemote.executeUpdate(CommandRemote.java:190)
   at org.h2.jdbc.JdbcPreparedStatement.execute(JdbcPreparedStatement.java:179)
   at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:601)
   at org.apache.ibatis.logging.jdbc.PreparedStatementLogger.invoke(PreparedStatementLogger.java:58)
   at $Proxy14.execute(Unknown Source)
   at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:41)
   at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:66)
   at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:45)
   at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:108)
   at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:75)
   at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:145)
   … 43 more
6018 [main] ERROR org.activiti.engine.impl.interceptor.CommandContext  - Error while closing command context
org.apache.ibatis.exceptions.PersistenceException:
### Error updating database.  Cause: org.h2.jdbc.JdbcSQLException: Referential integrity constraint violation: "ACT_FK_EVENT_EXEC: PUBLIC.ACT_RU_EVENT_SUBSCR FOREIGN KEY(EXECUTION_ID_) REFERENCES PUBL
IC.ACT_RU_EXECUTION(ID_) ('307')"; SQL statement:
delete from ACT_RU_EXECUTION where ID_ = ? and REV_ = ? [23503-170]
   at org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
   at org.h2.message.DbException.get(DbException.java:169)
   at org.h2.message.DbException.get(DbException.java:146)
   at org.h2.constraint.ConstraintReferential.checkRow(ConstraintReferential.java:414)
   at org.h2.constraint.ConstraintReferential.checkRowRefTable(ConstraintReferential.java:431)
   at org.h2.constraint.ConstraintReferential.checkRow(ConstraintReferential.java:307)
   at org.h2.table.Table.fireConstraints(Table.java:870)
   at org.h2.table.Table.fireAfterRow(Table.java:887)
   at org.h2.command.dml.Delete.update(Delete.java:99)
   at org.h2.command.CommandContainer.update(CommandContainer.java:75)
   at org.h2.command.Command.executeUpdate(Command.java:230)
   at org.h2.server.TcpServerThread.process(TcpServerThread.java:333)
   at org.h2.server.TcpServerThread.run(TcpServerThread.java:149)
   at java.lang.Thread.run(Thread.java:722)

### The error may involve org.activiti.engine.impl.persistence.entity.ExecutionEntity.deleteExecution-Inline
### The error occurred while setting parameters
### SQL: delete from ACT_RU_EXECUTION where ID_ = ? and REV_ = ?
### Cause: org.h2.jdbc.JdbcSQLException: Referential integrity constraint violation: "ACT_FK_EVENT_EXEC: PUBLIC.ACT_RU_EVENT_SUBSCR FOREIGN KEY(EXECUTION_ID_) REFERENCES PUBLIC.ACT_RU_EXECUTION(ID_) (
'307')"; SQL statement:
delete from ACT_RU_EXECUTION where ID_ = ? and REV_ = ? [23503-170]
   at org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
   at org.h2.message.DbException.get(DbException.java:169)
   at org.h2.message.DbException.get(DbException.java:146)
   at org.h2.constraint.ConstraintReferential.checkRow(ConstraintReferential.java:414)
   at org.h2.constraint.ConstraintReferential.checkRowRefTable(ConstraintReferential.java:431)
   at org.h2.constraint.ConstraintReferential.checkRow(ConstraintReferential.java:307)
   at org.h2.table.Table.fireConstraints(Table.java:870)
   at org.h2.table.Table.fireAfterRow(Table.java:887)
   at org.h2.command.dml.Delete.update(Delete.java:99)
   at org.h2.command.CommandContainer.update(CommandContainer.java:75)
   at org.h2.command.Command.executeUpdate(Command.java:230)
   at org.h2.server.TcpServerThread.process(TcpServerThread.java:333)
   at org.h2.server.TcpServerThread.run(TcpServerThread.java:149)
   at java.lang.Thread.run(Thread.java:722)

   at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:23)
   at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:147)
   at org.apache.ibatis.session.defaults.DefaultSqlSession.delete(DefaultSqlSession.java:158)
   at org.activiti.engine.impl.db.DbSqlSession$DeletePersistentObjectOperation.execute(DbSqlSession.java:236)
   at org.activiti.engine.impl.db.DbSqlSession.flushDeletes(DbSqlSession.java:667)
   at org.activiti.engine.impl.db.DbSqlSession.flush(DbSqlSession.java:461)
   at org.activiti.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:167)
   at org.activiti.engine.impl.interceptor.CommandContext.close(CommandContext.java:114)
   at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:69)
   at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:42)
   at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)
   at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:40)
   at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:32)
   at org.activiti.engine.impl.RepositoryServiceImpl.deleteDeployment(RepositoryServiceImpl.java:80)
   at org.activiti.engine.impl.test.TestHelper.annotationDeploymentTearDown(TestHelper.java:107)
   at org.activiti.engine.test.ActivitiRule.finished(ActivitiRule.java:119)
   at org.junit.rules.TestWatchman$1.evaluate(TestWatchman.java:54)
   at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
   at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
   at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
   at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
   at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
   at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
   at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
   at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
   at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
   at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
   at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
   at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
   at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)
   at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
   at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: org.h2.jdbc.JdbcSQLException: Referential integrity constraint violation: "ACT_FK_EVENT_EXEC: PUBLIC.ACT_RU_EVENT_SUBSCR FOREIGN KEY(EXECUTION_ID_) REFERENCES PUBLIC.ACT_RU_EXECUTION(ID_) (
'307')"; SQL statement:
delete from ACT_RU_EXECUTION where ID_ = ? and REV_ = ? [23503-170]
   at org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
   at org.h2.message.DbException.get(DbException.java:169)
   at org.h2.message.DbException.get(DbException.java:146)
   at org.h2.constraint.ConstraintReferential.checkRow(ConstraintReferential.java:414)
   at org.h2.constraint.ConstraintReferential.checkRowRefTable(ConstraintReferential.java:431)
   at org.h2.constraint.ConstraintReferential.checkRow(ConstraintReferential.java:307)
   at org.h2.table.Table.fireConstraints(Table.java:870)
   at org.h2.table.Table.fireAfterRow(Table.java:887)
   at org.h2.command.dml.Delete.update(Delete.java:99)
   at org.h2.command.CommandContainer.update(CommandContainer.java:75)
   at org.h2.command.Command.executeUpdate(Command.java:230)
   at org.h2.server.TcpServerThread.process(TcpServerThread.java:333)
   at org.h2.server.TcpServerThread.run(TcpServerThread.java:149)
   at java.lang.Thread.run(Thread.java:722)

   at org.h2.engine.SessionRemote.done(SessionRemote.java:505)
   at org.h2.command.CommandRemote.executeUpdate(CommandRemote.java:190)
   at org.h2.jdbc.JdbcPreparedStatement.execute(JdbcPreparedStatement.java:179)
   at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:601)
   at org.apache.ibatis.logging.jdbc.PreparedStatementLogger.invoke(PreparedStatementLogger.java:58)
   at $Proxy14.execute(Unknown Source)
   at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:41)
   at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:66)
   at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:45)
   at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:108)
   at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:75)
   at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:145)
   … 34 more
6027 [Thread-3] INFO  org.springframework.context.support.GenericApplicationContext  - Closing org.springframework.context.support.GenericApplicationContext@14b2819: startup date [Fri Dec 14 17:55:37
EET 2012]; root of context hierarchy

I can prepare a test project if you demand.
Thanks in advance.

UPDATE:
Let me explain some details before showing my findings.
I have 3 level processes: 1 main process which is shown in the image. Forget about the compensation and error handlers. I have 2 call activities named Local Loop Process and MDF Connection Process. Both call similar processes with different parameters(This is level 2). I pass a bean and a method name but I don't think it is important. In level 3, I just have a generic process trying to execute bean's method and handles error(s).

Local Loop Process -> Middle Tier1 Process -> Generic Process
MDF Connection Process -> Middle Tier2 Process -> Generic Process

In generic process(image here), as you see I have a 'Wait on IT Fault State' script task. In original erroneous process definition it was receive or user task. I changed it from receive task to user task and problem still exists. I changed it to a script task and problem is gone. The problem is it should be a wait state waiting for user/external system interaction.

I don't have a clue about this situation. If it is a script task then no error. If it is a wait state(receive/user task), after 3rd level's and 2nd level's completion, even after 1st level's completion I get the error above.
9 REPLIES 9

jbarrez
Star Contributor
Star Contributor
Very tricky to say something for a process of this size, so

I can prepare a test project if you demand.

That would be very helpful… Even better is a 'minimal' version of your process, where the error still happens.

gokceng1
Champ in-the-making
Champ in-the-making
Hi,
I've created 2 projects, one is utility used in the main test project: Util, Test

I've commented briefly test execution in code, if there is still problem please inform me, I will reply asap.

Thanks in advance.

gokceng1
Champ in-the-making
Champ in-the-making
Were you able to look at test projects?

mokematt
Champ in-the-making
Champ in-the-making
Hi,

is there any conclusion for this topic?
i got an  similar error in my process on an oracle database.

<code>
2013-12-12 15:38:59,564 [XML-RPC-0] ERROR org.activiti.engine.impl.interceptor.CommandContext  - Error while closing command context
org.apache.ibatis.exceptions.PersistenceException:
### Error updating database.  Cause: java.sql.SQLIntegrityConstraintViolationException: ORA-02292: integrity constraint (ACTIVITI.ACT_FK_EVENT_EXEC) violated - child record found

### The error may involve org.activiti.engine.impl.persistence.entity.ExecutionEntity.deleteExecution-Inline
### The error occurred while setting parameters
### SQL: delete from ACT_RU_EXECUTION where ID_ = ? and REV_ = ?
### Cause: java.sql.SQLIntegrityConstraintViolationException: ORA-02292: integrity constraint (ACTIVITI.ACT_FK_EVENT_EXEC) violated - child record found

        at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:23)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:150)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.delete(DefaultSqlSession.java:161)
        at org.activiti.engine.impl.db.DbSqlSession$CheckedDeleteOperation.execute(DbSqlSession.java:225)
        at org.activiti.engine.impl.db.DbSqlSession.flushDeletes(DbSqlSession.java:577)
        at org.activiti.engine.impl.db.DbSqlSession.flush(DbSqlSession.java:445)
        at org.activiti.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:170)
        at org.activiti.engine.impl.interceptor.CommandContext.close(CommandContext.java:117)
        at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:66)
        at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:31)
        at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:40)
        at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:35)
        at org.activiti.engine.impl.FormServiceImpl.submitTaskFormData(FormServiceImpl.java:70)
        at pucco.activiti.ActivitiService.completeTask(ActivitiService.java:160)
        at pucco.gwt.cls.CompleteTask.execute(CompleteTask.java:30)
        at pucco.gwt.GwtFunctionCall.call(GwtFunctionCall.java:65)
        at pucco.gwt.GwtFunctionService.completeTask(GwtFunctionService.java:44)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.apache.xmlrpc.server.ReflectiveXmlRpcHandler.invoke(ReflectiveXmlRpcHandler.java:115)
        at org.apache.xmlrpc.server.ReflectiveXmlRpcHandler.execute(ReflectiveXmlRpcHandler.java:106)
        at org.apache.xmlrpc.server.XmlRpcServerWorker.execute(XmlRpcServerWorker.java:46)
        at org.apache.xmlrpc.server.XmlRpcServer.execute(XmlRpcServer.java:86)
        at org.apache.xmlrpc.server.XmlRpcStreamServer.execute(XmlRpcStreamServer.java:200)
        at org.apache.xmlrpc.webserver.Connection.run(Connection.java:208)
        at org.apache.xmlrpc.util.ThreadPool$Poolable$1.run(ThreadPool.java:68)
Caused by: java.sql.SQLIntegrityConstraintViolationException: ORA-02292: integrity constraint (ACTIVITI.ACT_FK_EVENT_EXEC) violated - child record found

        at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:447)
        at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396)
        at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:951)
        at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:513)
        at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:227)
        at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:531)
        at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:208)
        at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:1046)
        at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1336)
        at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3613)
        at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3714)
        at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:1378)
        at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:41)
        at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:66)
        at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:45)
        at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:100)
        at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:75)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:148)
        … 26 more
</code>

greets

Matthias

jbarrez
Star Contributor
Star Contributor
When do you see this happening? Which call did you do that led to this stacktrace?

mokematt
Champ in-the-making
Champ in-the-making
This exception comes, when the end event of the process is reached and the process instance should be closed. Also a RuntimeService.deleteProcessInstance() throws the same exception.

I analysed this problem and came to following result:
In the ACT_RU_EXECUTION table were some executions that belongs to my process instance. The process instance execution itself, a subprocess and two executions for compensation events. Then i deleted the two execution lines for the compensation events and RuntimeService.deleteProcessInstance() finished successfully.
After that i deleted the compensation events and its service tasks from my process definition and the exceptions are not thrown any more.

I attached both process definitions to this post.

greets
Matthias

frederikherema1
Star Contributor
Star Contributor
Thanks for the thorough reporting and investigation, it's clearly the compensation-events that are the culprit. Even though they are marked as "EXPERIMENTAL", this kind of behaviour should be avoided. I'll look into this later today…

gokceng1
Champ in-the-making
Champ in-the-making
Hi frederik,
After 2 years, I've faced with the same problem using both 5.14 and 5.15 versions.
For 5.14, after some debugging I've seen that ExecutionEntity.ensureEventSubscriptionsInitialized method only loads eventSubscriptions when eventSubscriptions is null. We have similar 2 processes:
In 1 process when the code execution hits line number 1116, eventSubscriptions is null, so it retrieves the event subscriptions and it ends without a problem. In other process when the code execution hits line number 1116 eventSubscriptions is an empty list and this causes skipping retrieving subscriptions and problem occurs.

I'll take a look at why this occurs in my spare time but I wanted to give you a hint.
We've overcome this problem by this:

if (eventSubscriptions == null || eventSubscriptions.isEmpty()) {

      eventSubscriptions = Context.getCommandContext()
        .getEventSubscriptionEntityManager()
        .findEventSubscriptionsByExecution(id);
    }

Thank you.

jbarrez
Star Contributor
Star Contributor
That sounds indeed like a bug. Feel free to submit a pull request, as you pretty much solved it 🙂