cancel
Showing results for 
Search instead for 
Did you mean: 

Duplicate process ids

mitchyoung
Champ in-the-making
Champ in-the-making
Hi,
Just wondering if this is a known problem, or configuration issue.

I  am supporting a JSF application using Actitviti 5.9. It seems that duplicate process ids are being created while running a batch job that creates 100+ process instances.  In a method that iterates through the objects, a new process is started for each object.


At this point, randomly, a duplicate key will be retuned:
String procId = runtimeService.startProcessInstanceByKey("ffsClaimApproval", variables).getId();

These processes are running: async
<serviceTask id="thresholdCheckFFSClaim" name="Check Thresholds on FFS Claim" activiti:class="com.dms.workflow.ClaimCheckThresholdsDelegate" activiti:async="true" />

Out of 118 objects, 30 process instances failed because of a duplicate process id.

Which throws the below error:

2013-04-23 00:36:18,931 INFO  [com.dms.workflow.ClaimCheckThresholdsDelegate] (pool-32-thread-9) Claim #7,206 is ready to be checked against rate thresholds
2013-04-23 00:36:18,931 SEVERE [org.activiti.engine.impl.interceptor.CommandContext] (pool-32-thread-8) Error while closing command context: org.apache.ibatis.exceptions.PersistenceException:
### Error updating database.  Cause: java.sql.SQLIntegrityConstraintViolationException: ORA-00001: unique constraint (DMS.XX_ACT_PROCVER_UNIQUE) violated
### The error may involve org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity.insertProcessDefinition-Inline
### The error occurred while setting parameters
### Cause: java.sql.SQLIntegrityConstraintViolationException: ORA-00001: unique constraint (DMS.XX_ACT_PROCVER_UNIQUE) violated
3 REPLIES 3

frederikherema1
Star Contributor
Star Contributor
Does the com.dms.workflow.ClaimCheckThresholdsDelegate do anything with an Activiti-service? How is the activiti-engine fetched and constructed?

mitchyoung
Champ in-the-making
Champ in-the-making
Hi Frederik,
Thank you for your response.
The Activiti process engine is fetched as follows:
            RepositoryService repositoryService = processEngine.getRepositoryService();
            RuntimeService runtimeService = processEngine.getRuntimeService();
This is in the method that that loops through the objects but is outside of the loop.

The process definition is deployed inside the loop:
repositoryService.createDeployment().addClasspathResource("ffs-claim-approval.bpmn20.xml").deploy();

A new  process instance is created inside the loop for each claim object:
String procId = runtimeService.startProcessInstanceByKey("ffsClaimApproval", variables).getId();

The application is running on JBoss jboss-6.1.0.Final


The ClaimCheckThresholdsDelegate class sets variables to the DelegateExecution object via  execution.setVariable("approved", true) but does not do anything with Activiti-service.

I have attached the method that loops through the claim objects and creates the process instances: processFFSClaims.txt.
Also the ClaimCheckThresholdsDelegate class and the process definition xml.

Hope that's OK,
Thanks again.
Mitch Young

frederikherema1
Star Contributor
Star Contributor
I see… Is the transaction spanning the whole method (that is in processFSSClaims)? What's the isolation-level on the DB-transactions?