ACTIVITI 6 + Spring-Boot 1.5 : MySQLIntegrityConstraintViolationException

cancel
Showing results for 
Search instead for 
Did you mean: 
dgosset
Member II

ACTIVITI 6 + Spring-Boot 1.5 : MySQLIntegrityConstraintViolationException

Hi Community,

I'm playing with Spring-Boot 1.5.9.RELEASE and Activiti 6.0.0 + MySQL

I started with one datasource, and then to 2 datasources, one for activiti, one for business entity.

I tried to change the activiti settings, to ping jdbc pool, set max transaction to 80. (And i have also a Timeout: Pool empty. Unable to fetch a connection in 30 seconds, none available[size:100; busy:100; idle:0; lastwait:30000], but this a second issue, il will create another "post")

But when i have some jobs running at the same time, i have this issue : MySQLIntegrityConstraintViolationException.

Even if i use one 1 or 2 datasource, even if i change some settings.

My Bpm is compose with a "start event", some "service task" (with java class behind), this tasks are "asynchronus" and "exclusive", some "exclusive gateway" ("not asynchronus" & "exclusive") between services, and the "end event".

Thanks

-- 

2018-01-23 02:38:41,396 [SimpleAsyncTaskExecutor-347760] ERROR o.a.e.i.a.ExecuteAsyncRunnable - Job 352123 failed
org.apache.ibatis.exceptions.PersistenceException:
### Error updating database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails (`botactiviti`.`act_ru_variable`, CONSTRAINT `ACT_FK_VAR_EXE` FOREIGN KEY (`EXECUTION_ID_`) REFERENCES `act_ru_execution` (`ID_`))
### The error may involve org.activiti.engine.impl.persistence.entity.ExecutionEntityImpl.deleteExecution-Inline
### The error occurred while setting parameters
### SQL: delete from ACT_RU_EXECUTION where ID_ = ? and REV_ = ?
### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails (`botactiviti`.`act_ru_variable`, CONSTRAINT `ACT_FK_VAR_EXE` FOREIGN KEY (`EXECUTION_ID_`) REFERENCES `act_ru_execution` (`ID_`))
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:200)
at org.apache.ibatis.session.defaults.DefaultSqlSession.delete(DefaultSqlSession.java:213)
at org.activiti.engine.impl.db.DbSqlSession.flushDeleteEntities(DbSqlSession.java:770)
at org.activiti.engine.impl.db.DbSqlSession.flushDeletes(DbSqlSession.java:733)
at org.activiti.engine.impl.db.DbSqlSession.flush(DbSqlSession.java:419)
at org.activiti.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:197)
at org.activiti.engine.impl.interceptor.CommandContext.close(CommandContext.java:75)
at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:72)
at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:47)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:45)
at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:29)
at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:44)
at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:39)
at org.activiti.engine.impl.asyncexecutor.ExecuteAsyncRunnable.executeJob(ExecuteAsyncRunnable.java:97)
at org.activiti.engine.impl.asyncexecutor.ExecuteAsyncRunnable.run(ExecuteAsyncRunnable.java:75)
at java.lang.Thread.run(Thread.java:745)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails (`botactiviti`.`act_ru_variable`, CONSTRAINT `ACT_FK_VAR_EXE` FOREIGN KEY (`EXECUTION_ID_`) REFERENCES `act_ru_execution` (`ID_`))
at sun.reflect.GeneratedConstructorAccessor155.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
at com.mysql.jdbc.Util.getInstance(Util.java:408)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:935)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3973)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3909)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2527)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2680)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2487)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1858)
at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1197)
at sun.reflect.GeneratedMethodAccessor43.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.apache.tomcat.jdbc.pool.StatementFacade$StatementProxy.invoke(StatementFacade.java:114)
at com.sun.proxy.$Proxy102.execute(Unknown Source)
at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:46)
at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:74)
at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:50)
at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117)
at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:76)
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:198)
... 16 common frames omitted

1 Reply
daisuke-yoshimo
Senior Member

Re: ACTIVITI 6 + Spring-Boot 1.5 : MySQLIntegrityConstraintViolationException

Can you share the process definitions and the source code service tasks in which the issue are reproduced?

> But when i have some jobs running at the same time, i have this issue : MySQLIntegrityConstraintViolationException.

Please tell me more about this content.

> Even if i use one 1 or 2 datasource, even if i change some settings.

Does not the issue reproduce if the setting is the default?