AnsweredAssumed Answered

Activiti Optimistic Lock Exception with multiple process engines.

Question asked by gjaya26 on Feb 23, 2018
Latest reply on Feb 28, 2018 by daisuke-yoshimoto

We have a bpmn definition, using which we generate about 70K workflows each quarter. All this time, we were creating workflows only in one database. There is an organizational pitch to create workflows in multiple databases. After we introuduced multiple database configuration, we noticed optimisticlock exception while generating 70K workflows.

We do not see any loss of workflow data, however, we see the exception which bothers us.

To throw some light, we have in our xml - three different jndi to three different databases.

Each of the jndi source have their own transaction manager.

<bean id="processEngineConfiguration" class="class extends org.activiti.spring.SpringProcessEngineConfiguration">
<property name="dataSource" ref="dataSource" />
<property name="dataSourceJndiName" value="#{jndiUrls.jndiWFEngine}" />
<property name="transactionManager" ref="transactionManager" />
<property name="databaseSchemaUpdate" value="true" />
<property name="jobExecutorActivate" value="true" />
<property name="enableDatabaseEventLogging" value="true" />
<property name="activityBehaviorFactory" ref="activityBehaviorFactory"/>



We have the above configuration for each datasource. After introducing this configuration, we see optimisticlock exception. Stack trace is:

RuntimeService.postTaskForm(): exception: org.activiti.engine.ActivitiOptimisticLockingException: HistoricVariableInstanceEntity[id=0b532b38-1319-11e8-9dc9-005056bddfe9, name=PreparerSecGroup, revision=0, type=string, textValue=something] was updated by another transaction concurrently.


Can you please provide some pointers on how to resolve this error?

we do not have this issue when we are working with a single database.