Strange question - startProcessInstanceById() cause error

This is my first time asking a question in the forum.flowable.org . Please forgive me if the description is unclear.
这是我第一次在forum.flowable.org提问,如果有描述不清楚的地方请包容

When I request service for the first time, there will be no errors, but I will get an error when I request again
当我第一次请求服务时不会出错,但后续请求就会出现异常

If you can help me, I will be very grateful
如果你能帮助我,我将十分感激

The error occurs in the following code
错误发生在以下代码

ProcessInstance processInstance = runtimeService.startProcessInstanceById(req.getProcessDefinitionId(), req.getBusinessId(), variables);

This is the error log
这是错误日志

org.apache.ibatis.exceptions.PersistenceException: 

Error updating database. Cause: java.sql.SQLIntegrityConstraintViolationException: Cannot add or update a child row: a foreign key constraint fails (dev_xx.act_ru_task, CONSTRAINT ACT_FK_TASK_EXE FOREIGN KEY (EXECUTION_ID_) REFERENCES act_ru_execution (ID_))

The error may exist in org/flowable/task/service/db/mapping/entity/Task.xml

The error may involve org.flowable.task.service.impl.persistence.entity.TaskEntityImpl.insertTask-Inline

The error occurred while setting parameters

SQL: insert into ACT_RU_TASK (ID_, REV_, NAME_, PARENT_TASK_ID_, DESCRIPTION_, PRIORITY_, CREATE_TIME_, OWNER_, ASSIGNEE_, DELEGATION_, EXECUTION_ID_, PROC_INST_ID_, PROC_DEF_ID_, TASK_DEF_ID_, SCOPE_ID_, SUB_SCOPE_ID_, SCOPE_TYPE_, SCOPE_DEFINITION_ID_, TASK_DEF_KEY_, DUE_DATE_, CATEGORY_, SUSPENSION_STATE_, TENANT_ID_, FORM_KEY_, CLAIM_TIME_, IS_COUNT_ENABLED_, VAR_COUNT_, ID_LINK_COUNT_, SUB_TASK_COUNT_) values (?, 1, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )

Cause: java.sql.SQLIntegrityConstraintViolationException: Cannot add or update a child row: a foreign key constraint fails (dev_xx.act_ru_task, CONSTRAINT ACT_FK_TASK_EXE FOREIGN KEY (EXECUTION_ID_) REFERENCES act_ru_execution (ID_))

Hi, I have the same issue. Did you find a solution ? Thanks

Any additional informaton you can provide will be helpful:

  • Flowable Version
  • Database you are using
  • Engine configuration

The database version is 6.5.0.6.
We are using Microsoft SQL Server.

(Meant for orginal author) Please use english for all communication. We have people from all over the world contributing to this forum, with various native languages.

@JamalZ: The exception itself doesn’t say anything, can you share your model and/or a unit test to reproduce the problem?

I can share with you the configuration class :slight_smile:

package com.bdl.epbs_process_api;

import java.util.HashMap;
import java.util.Map;
import java.util.UUID;

import javax.sql.DataSource;

import org.flowable.cmmn.engine.CmmnEngine;
import org.flowable.cmmn.engine.CmmnEngineConfiguration;
import org.flowable.cmmn.engine.impl.agenda.DefaultCmmnEngineAgendaFactory;
import org.flowable.cmmn.spring.CmmnEngineFactoryBean;
import org.flowable.cmmn.spring.SpringCmmnEngineConfiguration;
import org.flowable.common.engine.impl.persistence.StrongUuidGenerator;
import org.flowable.engine.ProcessEngine;
import org.flowable.engine.ProcessEngineConfiguration;
import org.flowable.engine.impl.agenda.DefaultFlowableEngineAgendaFactory;
import org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl;
import org.flowable.engine.spring.configurator.SpringProcessEngineConfigurator;
import org.flowable.spring.ProcessEngineFactoryBean;
import org.flowable.spring.SpringProcessEngineConfiguration;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.core.env.Environment;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.transaction.PlatformTransactionManager;

import com.bdl.epbs_process_api.delegate.epbs.CheckConvAMTasks;
import com.bdl.epbs_process_api.utils.DefaultClockImpl;
import com.zaxxer.hikari.HikariDataSource;

@Configuration
public class BDLFlowableEnginesConfiguration {

@Autowired
private Environment env;

private SpringProcessEngineConfiguration processEngineConfiguration;

private SpringCmmnEngineConfiguration cmmnEngineConfigurationBdl;

@Primary
@Bean
public DataSource dsFlowableBDLEngine() {
	HikariDataSource dataSource = new HikariDataSource();
	dataSource.setPoolName("dataSource_" + UUID.randomUUID().toString());
	dataSource.setJdbcUrl(env.getProperty("flowable.datasource.url"));
	dataSource.setDriverClassName(env.getProperty("flowable.datasource.driver.class"));
	dataSource.setUsername(env.getProperty("flowable.datasource.username"));
	dataSource.setPassword(env.getProperty("flowable.datasource.password"));
	dataSource.setMaximumPoolSize(50);
	dataSource.setUsername(env.getProperty("flowable.datasource.username"));
	dataSource.setPassword(env.getProperty("flowable.datasource.password"));
	dataSource.setMaximumPoolSize(50);
	return dataSource;
}

@Primary
@Bean(name = "flowableTransactionManager")
public PlatformTransactionManager transactionManager() {
	DataSourceTransactionManager transactionManager = new DataSourceTransactionManager();
	transactionManager.setDataSource(dsFlowableBDLEngine());
	return transactionManager;
}

@Bean(name = "processEngineFactoryBean")
public ProcessEngineFactoryBean processEngineFactoryBean() {
	ProcessEngineFactoryBean factoryBean = new ProcessEngineFactoryBean();
	factoryBean.setProcessEngineConfiguration(processEngineConfiguration());
	return factoryBean;
}

@Bean(name = "cmmnEngineFactoryBean")
public CmmnEngineFactoryBean cmmnEngineFactoryBean() {
	CmmnEngineFactoryBean factoryBean = new CmmnEngineFactoryBean();
	factoryBean.setCmmnEngineConfiguration(cmmnEngineConfigurationBdl());
	return factoryBean;
}

@Primary
@Bean
public ProcessEngineConfigurationImpl processEngineConfiguration() {
	
	if (processEngineConfiguration == null) {
		processEngineConfiguration = new SpringProcessEngineConfiguration();
		processEngineConfiguration.setDataSource(dsFlowableBDLEngine());
		processEngineConfiguration.setTransactionManager(transactionManager());
		processEngineConfiguration.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE);
		processEngineConfiguration.setIdGenerator(new StrongUuidGenerator());
		// Async history configuration
		processEngineConfiguration.setAsyncHistoryEnabled(true);
		processEngineConfiguration.setAsyncHistoryExecutorActivate(true);

		processEngineConfiguration.setAsyncExecutorActivate(true);
		processEngineConfiguration.setAgendaFactory(new DefaultFlowableEngineAgendaFactory());
		// Optional tweaking
		processEngineConfiguration.setAsyncHistoryJsonGroupingEnabled(true);
		processEngineConfiguration.setAsyncHistoryJsonGzipCompressionEnabled(true);
		processEngineConfiguration.setAsyncHistoryJsonGroupingThreshold(10);

		processEngineConfiguration.resetClock();
		processEngineConfiguration.setClock(new DefaultClockImpl());
		
		processEngineConfiguration.setDisableEventRegistry(true);
		
	}
	
	return processEngineConfiguration;
}

@Primary
@Bean 
public CmmnEngineConfiguration cmmnEngineConfigurationBdl() {
	
	if (cmmnEngineConfigurationBdl == null) {
		cmmnEngineConfigurationBdl = new SpringCmmnEngineConfiguration();
		cmmnEngineConfigurationBdl.setDataSource(dsFlowableBDLEngine());
		cmmnEngineConfigurationBdl.setTransactionManager(transactionManager());
		cmmnEngineConfigurationBdl.setDatabaseSchemaUpdate(CmmnEngineConfiguration.DB_SCHEMA_UPDATE_TRUE); 
		cmmnEngineConfigurationBdl.setIdGenerator(new StrongUuidGenerator()); 
		// Async history configuration 
		cmmnEngineConfigurationBdl.setAsyncHistoryEnabled(true);
		cmmnEngineConfigurationBdl.setAsyncHistoryExecutorActivate(true);
		cmmnEngineConfigurationBdl.setCmmnEngineAgendaFactory(new DefaultCmmnEngineAgendaFactory());
		cmmnEngineConfigurationBdl.setAsyncExecutorActivate(true); // Optional tweaking
		cmmnEngineConfigurationBdl.setAsyncHistoryJsonGroupingEnabled(true);
		cmmnEngineConfigurationBdl.setAsyncHistoryJsonGzipCompressionEnabled(true);
		cmmnEngineConfigurationBdl.setAsyncHistoryJsonGroupingThreshold(10);

		Map<Object, Object> customBeans = new HashMap<>();
		customBeans.put("checkConvAMTasks", CheckConvAMTasks.class);
		
		cmmnEngineConfigurationBdl.setBeans(customBeans);

		cmmnEngineConfigurationBdl.resetClock(); 
		cmmnEngineConfigurationBdl.setClock(new DefaultClockImpl()); 
		
		SpringProcessEngineConfigurator processEngineConfigurator = new SpringProcessEngineConfigurator();
		processEngineConfigurator.setProcessEngineConfiguration(processEngineConfiguration());
		
		cmmnEngineConfigurationBdl.addConfigurator(processEngineConfigurator);
	}

	return cmmnEngineConfigurationBdl; 
}


@Primary
@Bean
public ProcessEngine processEngine() {

	ProcessEngine processEngine;

	try {
		processEngine = this.processEngineConfiguration().buildProcessEngine();
	} catch (Exception e) {
		throw new RuntimeException(e);
	}
	//		Process BPM Deployment
	processEngine.getRepositoryService().createDeployment().addClasspathResource("processes/fund_event.bpmn20.xml")
	.deploy();
	processEngine.getRepositoryService().createDeployment()
	.addClasspathResource("processes/change_business_activity.bpmn20.xml").deploy();
	processEngine.getRepositoryService().createDeployment()
	.addClasspathResource("processes/miscellaneous.bpmn20.xml").deploy();
	processEngine.getRepositoryService().createDeployment().addClasspathResource("processes/template.bpmn20.xml")
	.deploy();
	processEngine.getRepositoryService().createDeployment()
	.addClasspathResource("processes/modify_related_entities.bpmn20.xml").deploy();
	processEngine.getRepositoryService().createDeployment()
	.addClasspathResource("processes/fund_initial_load.bpmn20.xml").deploy();
	//		Case Workflow
	processEngine.getRepositoryService().createDeployment()
	.addClasspathResource("processes/workflow1-standard.bpmn20.xml").deploy();
	processEngine.getRepositoryService().createDeployment()
	.addClasspathResource("processes/workflow2-validationPBAC.bpmn20.xml").deploy();
	processEngine.getRepositoryService().createDeployment()
	.addClasspathResource("processes/workflow2-validationPBACNA.bpmn20.xml").deploy();
	processEngine.getRepositoryService().createDeployment()
	.addClasspathResource("processes/workflow4-standardNA.bpmn20.xml").deploy();
	processEngine.getRepositoryService().createDeployment()
	.addClasspathResource("processes/workflow5-golive.bpmn20.xml").deploy();		

// processEngine.getProcessEngineConfiguration().initSessionFactories();

	return processEngine;
}

@Primary
@Bean
public CmmnEngine cmmnEngine() {

	CmmnEngine caseEngine;

	try {
		caseEngine = this.cmmnEngineConfigurationBdl().buildCmmnEngine();
	} catch (Exception e) {
		throw new RuntimeException(e);
	}
	//		Process CMMN Deployment
	caseEngine.getCmmnRepositoryService().createDeployment()
	.addClasspathResource("cases/ePBS_ONB_Backbone_iis.cmmn.xml").deploy();
	caseEngine.getCmmnRepositoryService().createDeployment()
	.addClasspathResource("cases/ePBS_ONB_Backbone_ics.cmmn.xml").deploy();
	caseEngine.getCmmnRepositoryService().createDeployment()
	.addClasspathResource("cases/ePBS_ONB_Backbone_fund.cmmn.xml").deploy();
	caseEngine.getCmmnRepositoryService().createDeployment()
	.addClasspathResource("cases/ePBS_ONB_Backbone_test.cmmn.xml").deploy();

	/*caseEngine.getCmmnEngineConfiguration().initSessionFactories();
	caseEngine.getCmmnEngineConfiguration().initSessionFactories();
	caseEngine.getCmmnEngineConfiguration().initCmmnEngineAgendaFactory();*/

	return caseEngine;
}

}

The config doesn’t help much (as that’s most likely correct)- it’s the runtime that will insert the task in the table. So we’d need something that generates that exception from starting a process instance.

(or is it a case? Seeing you have the cmmn engine configured, too).

Yes I’m trying to start a case like this :slight_smile:

	// Prepare all process variables to store in flowable
	Map<String, Object> params = new HashMap<>();
	params.put("projectId", backboneDto.getProjectId());
	params.put("projectScope", backboneDto.getProjectScope());
	params.put("projectCreator", backboneDto.getProjectCreator());
	params.put("actions", "start");
	params.put("type", "onboarding");
	// Start the Case and save the variable
	CaseInstance caseInstance = cmmnRuntimeService.createCaseInstanceBuilder()
			.caseDefinitionKey("ePBS_ONB_Backbone_" + backboneDto.getProjectScope()).variables(params).start();
	this.createC2xmTaskCase(caseInstance);
	return null;
}

Full stack trace error :slight_smile:
2020-11-09 14:15:38,513 HT447 ERROR epbs_process_api DEV bllu [http-nio-8080-exec-2] [5a622eaf-9b9e-4904-8535-678acdaea971] org.flowable.common.engine.impl.interceptor.CommandContext user=HENBAI0 - Error while closing command context
org.apache.ibatis.exceptions.PersistenceException:

Error updating database. Cause: com.microsoft.sqlserver.jdbc.SQLServerException: The INSERT statement conflicted with the FOREIGN KEY constraint “ACT_FK_TASK_EXE”. The conflict occurred in database “ePBS_PROCESS”, table “dbo.ACT_RU_EXECUTION”, column ‘ID_’.

The error may exist in org/flowable/task/service/db/mapping/entity/Task.xml

The error may involve org.flowable.task.service.impl.persistence.entity.TaskEntityImpl.insertTask-Inline

The error occurred while setting parameters

SQL: insert into ACT_RU_TASK (ID_, REV_, NAME_, PARENT_TASK_ID_, DESCRIPTION_, PRIORITY_, CREATE_TIME_, OWNER_, ASSIGNEE_, DELEGATION_, EXECUTION_ID_, PROC_INST_ID_, PROC_DEF_ID_, TASK_DEF_ID_, SCOPE_ID_, SUB_SCOPE_ID_, SCOPE_TYPE_, SCOPE_DEFINITION_ID_, PROPAGATED_STAGE_INST_ID_, TASK_DEF_KEY_, DUE_DATE_, CATEGORY_, SUSPENSION_STATE_, TENANT_ID_, FORM_KEY_, CLAIM_TIME_, IS_COUNT_ENABLED_, VAR_COUNT_, ID_LINK_COUNT_, SUB_TASK_COUNT_) values (?, 1, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )

Cause: com.microsoft.sqlserver.jdbc.SQLServerException: The INSERT statement conflicted with the FOREIGN KEY constraint “ACT_FK_TASK_EXE”. The conflict occurred in database “ePBS_PROCESS”, table “dbo.ACT_RU_EXECUTION”, column ‘ID_’.

at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:199)
at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:184)
at org.flowable.common.engine.impl.db.DbSqlSession.flushRegularInsert(DbSqlSession.java:509)
at org.flowable.common.engine.impl.db.DbSqlSession.flushInsertEntities(DbSqlSession.java:490)
at org.flowable.common.engine.impl.db.DbSqlSession.flushInserts(DbSqlSession.java:473)
at org.flowable.common.engine.impl.db.DbSqlSession.flush(DbSqlSession.java:358)
at org.flowable.common.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:192)
at org.flowable.common.engine.impl.interceptor.CommandContext.close(CommandContext.java:61)
at org.flowable.common.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:81)
at org.flowable.common.spring.SpringTransactionInterceptor.lambda$execute$0(SpringTransactionInterceptor.java:56)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)
at org.flowable.common.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:56)
at org.flowable.common.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:30)
at org.flowable.common.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:56)
at org.flowable.common.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:51)
at org.flowable.cmmn.engine.impl.runtime.CmmnRuntimeServiceImpl.startCaseInstance(CmmnRuntimeServiceImpl.java:99)
at org.flowable.cmmn.engine.impl.runtime.CaseInstanceBuilderImpl.start(CaseInstanceBuilderImpl.java:188)
at com.bdl.epbs_process_api.services.BackboneService.startOnboardingProcess(BackboneService.java:59)
at com.bdl.epbs_process_api.controllers.BackboneController.createTask(BackboneController.java:38)
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.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:105)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:879)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:793)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:660)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:320)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:126)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:90)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:118)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:158)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at com.bdl.security.jwt.asym.filter.BDLSecurityFilter.doFilterInternal(BDLSecurityFilter.java:70)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:92)
at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:77)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:215)
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at com.bdl.security.logging.RequestAndResponseLoggingFilter.doFilter(RequestAndResponseLoggingFilter.java:61)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at com.bdl.logging.filter.RequestAndResponsePayloadLoggingFilter.doFilter(RequestAndResponsePayloadLoggingFilter.java:47)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:109)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at com.bdl.logging.web.GlueCodeFilter.doFilter(GlueCodeFilter.java:51)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:373)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1594)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)

Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: The INSERT statement conflicted with the FOREIGN KEY constraint “ACT_FK_TASK_EXE”. The conflict occurred in database “ePBS_PROCESS”, table “dbo.ACT_RU_EXECUTION”, column ‘ID_’.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:262)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1624)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:594)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:524)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7194)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:2979)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:248)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:223)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.execute(SQLServerPreparedStatement.java:505)
at com.zaxxer.hikari.pool.ProxyPreparedStatement.execute(ProxyPreparedStatement.java:44)
at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.execute(HikariProxyPreparedStatement.java)
at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:47)
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:197)
… 115 common frames omitted

All code for starting looks as expected. Is there a way you could share a (minimal) CMMN model so we can reproduce?

With the stacktrace alone, we can’t say much: Flowable keeps all db operations to the end of the transaction and then flushes everything together, hence why the stacktrace will always show one of the flush() methods, but not the actual place where the entity is handled.