AnsweredAssumed Answered

Urgent..Error: updated by another transaction concurrently

Question asked by kethur on Nov 28, 2012
Latest reply on Nov 30, 2012 by jbarrez
Hi Team,

I am struggling to find whats wrong with my process.  I am getting an error when my process reaches a task called "Reading".  Could you suggest what am i doing wrong?

27-Nov-2012 10:47:31 org.activiti.engine.impl.interceptor.CommandContext close
SEVERE: Error while closing command context
org.activiti.engine.ActivitiOptimisticLockingException: ByteArrayEntity[30] was updated by another transaction concurrently
   at org.activiti.engine.impl.db.DbSqlSession.flushUpdates(DbSqlSession.java:474)
   at org.activiti.engine.impl.db.DbSqlSession.flush(DbSqlSession.java:370)
   at org.activiti.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:157)
   at org.activiti.engine.impl.interceptor.CommandContext.close(CommandContext.java:109)
   at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:49)
   at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
   at org.activiti.engine.impl.TaskServiceImpl.complete(TaskServiceImpl.java:144)
   at com.xxx.holmes2.h2ng.workflow.activiti.business.impl.DocumentWorkflowTaskVariablesTest.afterTypingTaskFinishesTheQueueStateShouldSetToTypingComplete(DocumentWorkflowTaskVariablesTest.java:122)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

Here is my process.

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test">
  <process id="document_workflow_v03" name="Document Workflow">
    <subProcess id="subprocess1" name="Queue Processing">
      <endEvent id="endevent1" name="End"></endEvent>
      <userTask id="usertaskTyping" name="Typing">
        <extensionElements>
          <activiti:taskListener event="create" expression="${documentTaskCreateListener.notify(task)}"></activiti:taskListener>
          <activiti:taskListener event="complete" expression="${documentTaskCompleteListener.notify(task)}"></activiti:taskListener>
        </extensionElements>
      </userTask>
      <exclusiveGateway id="exclusivegateway1" name="Exclusive Gateway"></exclusiveGateway>
      <endEvent id="endeventNeedMoreStates" name="ErrorEnd">
        <errorEventDefinition errorRef="gotoNextStageError"></errorEventDefinition>
      </endEvent>
      <userTask id="usertaskCourtPrinting" name="Court Printing" activiti:async="true">
        <extensionElements>
          <activiti:taskListener event="create" expression="${documentTaskCreateListener.notify(task)}"></activiti:taskListener>
          <activiti:taskListener event="complete" expression="${documentTaskCompleteListener.notify(task)}"></activiti:taskListener>
        </extensionElements>
      </userTask>
      <userTask id="usertaskDisclosureAssessment" name="Disclosure Assessment">
        <extensionElements>
          <activiti:taskListener event="create" expression="${documentTaskCreateListener.notify(task)}"></activiti:taskListener>
          <activiti:taskListener event="complete" expression="${documentTaskCompleteListener.notify(task)}"></activiti:taskListener>
        </extensionElements>
      </userTask>
      <userTask id="usertaskReading" name="Reading">
        <extensionElements>
          <activiti:taskListener event="create" expression="${documentTaskCreateListener.notify(task)}"></activiti:taskListener>
          <activiti:taskListener event="complete" expression="${documentTaskCompleteListener.notify(task)}"></activiti:taskListener>
        </extensionElements>
      </userTask>
      <exclusiveGateway id="exclusivegateway6" name="Exclusive Gateway"></exclusiveGateway>
      <exclusiveGateway id="exclusivegateway9" name="Exclusive Gateway"></exclusiveGateway>
      <userTask id="usertaskProofReading" name="Proof Reading">
        <extensionElements>
          <activiti:taskListener event="create" expression="${documentTaskCreateListener.notify(task)}"></activiti:taskListener>
          <activiti:taskListener event="complete" expression="${documentTaskCompleteListener.notify(task)}"></activiti:taskListener>
        </extensionElements>
      </userTask>
      <exclusiveGateway id="exclusivegateway10" name="Exclusive Gateway"></exclusiveGateway>
      <exclusiveGateway id="exclusivegateway11" name="Exclusive Gateway"></exclusiveGateway>
      <userTask id="usertaskIndexing" name="Indexing">
        <extensionElements>
          <activiti:taskListener event="create" expression="${documentTaskCreateListener.notify(task)}"></activiti:taskListener>
          <activiti:taskListener event="complete" expression="${documentTaskCompleteListener.notify(task)}"></activiti:taskListener>
        </extensionElements>
      </userTask>
      <userTask id="usertaskApproval" name="Approval">
        <extensionElements>
          <activiti:taskListener event="create" expression="${documentTaskCreateListener.notify(task)}"></activiti:taskListener>
          <activiti:taskListener event="complete" expression="${documentTaskCompleteListener.notify(task)}"></activiti:taskListener>
        </extensionElements>
      </userTask>
      <exclusiveGateway id="exclusivegateway12" name="Exclusive Gateway"></exclusiveGateway>
      <startEvent id="starteventInner" name="Start"></startEvent>
      <sequenceFlow id="flow6" name="More Task Actions Required" sourceRef="exclusivegateway1" targetRef="endeventNeedMoreStates">
        <conditionExpression xsi:type="tFormalExpression"><![CDATA[${needMoreAction == 'true'}]]></conditionExpression>
      </sequenceFlow>
      <sequenceFlow id="flow12" name="Disclosure Assessment required" sourceRef="exclusivegateway1" targetRef="usertaskDisclosureAssessment">
        <conditionExpression xsi:type="tFormalExpression"><![CDATA[  ${documentQueue.getQueueState('usertaskDisclosureAssessment', queues) == 'disclosureAssessment_required'}]]></conditionExpression>
      </sequenceFlow>
      <sequenceFlow id="flow25" name="Typing Required" sourceRef="exclusivegateway6" targetRef="usertaskTyping">
        <conditionExpression xsi:type="tFormalExpression"><![CDATA[ ${documentQueue.getQueueState('usertaskTyping', queues) == 'typing_required'}]]></conditionExpression>
      </sequenceFlow>
      <sequenceFlow id="flow29" name="Typing not Required" sourceRef="exclusivegateway6" targetRef="exclusivegateway9">
        <conditionExpression xsi:type="tFormalExpression"><![CDATA[${documentQueue.getQueueState('usertaskTyping', queues) == 'typing_not_required' || documentQueue.getQueueState('usertaskTyping', queues) == 'Typing_complete'}
        ]]></conditionExpression>
      </sequenceFlow>
      <sequenceFlow id="flow30" name="Proof Reading Required" sourceRef="exclusivegateway9" targetRef="usertaskProofReading">
        <conditionExpression xsi:type="tFormalExpression"><![CDATA[ ${documentQueue.getQueueState('usertaskProofReading', queues) == 'proofReading_required'}]]></conditionExpression>
      </sequenceFlow>
      <sequenceFlow id="flow31" name="Court Printing required" sourceRef="exclusivegateway9" targetRef="usertaskCourtPrinting">
        <conditionExpression xsi:type="tFormalExpression"><![CDATA[ ${documentQueue.getQueueState('usertaskCourtPrinting', queues) == 'courtPrinting_required'}]]></conditionExpression>
      </sequenceFlow>
      <sequenceFlow id="flow33" name="Proof Reading Not Required" sourceRef="exclusivegateway9" targetRef="exclusivegateway10"></sequenceFlow>
      <sequenceFlow id="flowtoReading" name="Reading Required" sourceRef="exclusivegateway10" targetRef="usertaskReading">
        <conditionExpression xsi:type="tFormalExpression"><![CDATA[ ${documentQueue.getQueueState('usertaskReading', queues) == 'reading_required'}]]></conditionExpression>
      </sequenceFlow>
      <sequenceFlow id="flow34" name="Reading Not Required" sourceRef="exclusivegateway10" targetRef="exclusivegateway11">
        <conditionExpression xsi:type="tFormalExpression"><![CDATA[ ${documentQueue.getQueueState('usertaskReading', queues) == 'reading_not_required'}]]></conditionExpression>
      </sequenceFlow>
      <sequenceFlow id="flow35" name="Court Printing Required" sourceRef="exclusivegateway10" targetRef="usertaskCourtPrinting">
        <conditionExpression xsi:type="tFormalExpression"><![CDATA[ ${documentQueue.getQueueState('usertaskCourtPrinting', queues) == 'courtPrinting_required'}]]></conditionExpression>
      </sequenceFlow>
      <sequenceFlow id="flow36" name="Indexing Required" sourceRef="exclusivegateway11" targetRef="usertaskIndexing">
        <conditionExpression xsi:type="tFormalExpression"><![CDATA[ ${documentQueue.getQueueState('usertaskIndexing', queues) == 'indexing_required'}]]></conditionExpression>
      </sequenceFlow>
      <sequenceFlow id="flow37" name="Indexing Not Required" sourceRef="exclusivegateway11" targetRef="exclusivegateway12">
        <conditionExpression xsi:type="tFormalExpression"><![CDATA[ ${documentQueue.getQueueState('usertaskIndexing', queues) == 'indexing_not_required'}]]></conditionExpression>
      </sequenceFlow>
      <sequenceFlow id="flow38" name="Approval Required" sourceRef="exclusivegateway12" targetRef="usertaskApproval">
        <conditionExpression xsi:type="tFormalExpression"><![CDATA[ ${documentQueue.getQueueState('usertaskApproval', queues) == 'approval_not_required'}]]></conditionExpression>
      </sequenceFlow>
      <sequenceFlow id="flow39" name="Court Printing Required" sourceRef="exclusivegateway11" targetRef="usertaskCourtPrinting">
        <conditionExpression xsi:type="tFormalExpression"><![CDATA[ ${documentQueue.getQueueState('usertaskCourtPrinting', queues) == 'courtPrinting_required'}]]></conditionExpression>
      </sequenceFlow>
      <sequenceFlow id="flow40" name="Court Printing required" sourceRef="exclusivegateway12" targetRef="usertaskCourtPrinting">
        <conditionExpression xsi:type="tFormalExpression"><![CDATA[${documentQueue.getQueueState('usertaskCourtPrinting', queues) == 'courtPrinting_required'}]]></conditionExpression>
      </sequenceFlow>
      <sequenceFlow id="flow41" name="" sourceRef="usertaskProofReading" targetRef="endeventNeedMoreStates">
        <conditionExpression xsi:type="tFormalExpression"><![CDATA[${needMoreAction == 'true'}]]></conditionExpression>
      </sequenceFlow>
      <sequenceFlow id="flow42" name="" sourceRef="usertaskReading" targetRef="endeventNeedMoreStates">
        <conditionExpression xsi:type="tFormalExpression"><![CDATA[${needMoreAction == 'true'}]]></conditionExpression>
      </sequenceFlow>
      <sequenceFlow id="flow43" name="" sourceRef="usertaskIndexing" targetRef="endeventNeedMoreStates">
        <conditionExpression xsi:type="tFormalExpression"><![CDATA[${needMoreAction == 'true'}]]></conditionExpression>
      </sequenceFlow>
      <sequenceFlow id="flow44" name="" sourceRef="usertaskApproval" targetRef="endeventNeedMoreStates">
        <conditionExpression xsi:type="tFormalExpression"><![CDATA[${needMoreAction == 'true'}]]></conditionExpression>
      </sequenceFlow>
      <sequenceFlow id="flow48" name="" sourceRef="usertaskDisclosureAssessment" targetRef="endeventNeedMoreStates">
        <conditionExpression xsi:type="tFormalExpression"><![CDATA[${needMoreAction == 'true'}]]></conditionExpression>
      </sequenceFlow>
      <sequenceFlow id="flow49" name="" sourceRef="usertaskCourtPrinting" targetRef="endeventNeedMoreStates">
        <conditionExpression xsi:type="tFormalExpression"><![CDATA[${needMoreAction == 'true'}]]></conditionExpression>
      </sequenceFlow>
      <sequenceFlow id="flow50" name="Court Printing Required" sourceRef="exclusivegateway6" targetRef="usertaskCourtPrinting">
        <conditionExpression xsi:type="tFormalExpression"><![CDATA[ ${documentQueue.getQueueState('usertaskCourtPrinting', queues) == 'courtPrinting_required'}]]></conditionExpression>
      </sequenceFlow>
      <sequenceFlow id="flow55" name="" sourceRef="starteventInner" targetRef="exclusivegateway6"></sequenceFlow>
      <sequenceFlow id="flow3" name="Typing Complete" sourceRef="usertaskTyping" targetRef="exclusivegateway1"></sequenceFlow>
    </subProcess>
    <boundaryEvent id="catchNeedToGotoNextStageError" name="" cancelActivity="false" attachedToRef="subprocess1">
      <errorEventDefinition errorRef="gotoNextStageError"></errorEventDefinition>
    </boundaryEvent>
    <startEvent id="starteventOuter" name="Start">
      <extensionElements>
        <activiti:formProperty id="registration_required" name="Registration Required" type="string" required="false"></activiti:formProperty>
        <activiti:formProperty id="registration_not_required" name="Registration Not Required" type="string" required="false"></activiti:formProperty>
        <activiti:formProperty id="registration_complete" name="Registration Completed" type="string" required="false"></activiti:formProperty>
        <activiti:formProperty id="typing_required" name="Typing Required" type="string" required="false"></activiti:formProperty>
        <activiti:formProperty id="typing_not_required" name="Typing Not Required" type="string" required="false"></activiti:formProperty>
        <activiti:formProperty id="typing_complete" name="Typing Complete" type="string" required="false"></activiti:formProperty>
        <activiti:formProperty id="proofReading_required" name="Proof Reading Required" type="string" required="false"></activiti:formProperty>
        <activiti:formProperty id="proofReading_not_required" name="Proof Reading Not Required" type="string" required="false"></activiti:formProperty>
        <activiti:formProperty id="proofReading_complete" name="Proof Reading Complete" type="string" required="false"></activiti:formProperty>
        <activiti:formProperty id="courtPrinting_required" name="Court Printing Required" type="string" required="false"></activiti:formProperty>
        <activiti:formProperty id="courtPrinting_not_required" name="Court Printing Not Required" type="string" required="false"></activiti:formProperty>
        <activiti:formProperty id="courtPrinting_complete" name="Court Printing Complete" type="string" required="false"></activiti:formProperty>
        <activiti:formProperty id="reading_required" name="Reading Required" type="string" required="false"></activiti:formProperty>
        <activiti:formProperty id="reading_not_required" name="Reading Not Required" type="string" required="false"></activiti:formProperty>
        <activiti:formProperty id="reading_complete" name="Reading Complete" type="string" required="false"></activiti:formProperty>
        <activiti:formProperty id="indexing_required" name="Indexing Required" type="string" required="false"></activiti:formProperty>
        <activiti:formProperty id="indexing_not_required" name="Indexing Not Required" type="string" required="false"></activiti:formProperty>
        <activiti:formProperty id="indexing_complete" name="Indexing Complete" type="string" required="false"></activiti:formProperty>
        <activiti:formProperty id="approval_required" name="Approval Required" type="string" required="false"></activiti:formProperty>
        <activiti:formProperty id="approval_not_required" name="Approval Not Required" type="string" required="false"></activiti:formProperty>
        <activiti:formProperty id="approval_complete" name="Approval Complete" type="string" required="false"></activiti:formProperty>
        <activiti:formProperty id="disclosureAssessment_required" name="Disclosure Assessment Required" type="string" required="false"></activiti:formProperty>
        <activiti:formProperty id="disclosureAssessment_not_required" name="Disclosure Assessment Not Required" type="string" required="false"></activiti:formProperty>
        <activiti:formProperty id="disclosureAssessment_complete" name="Disclosure Assessment Complete" type="string" required="false"></activiti:formProperty>
        <activiti:formProperty id="docType_I_INTERVIEW_ProofReading" name="I_INTERVIEW:proofReading_not_required" type="string" required="false"></activiti:formProperty>
        <activiti:formProperty id="docType_I_MESSAGE_ProofReading" name="I_MESSAGE:proofReading_not_required" type="string" required="false"></activiti:formProperty>
        <activiti:formProperty id="docType_I_MESSAGE_Typing" name="I_MESSAGE:typing_complete" type="string" required="false"></activiti:formProperty>
        <activiti:formProperty id="docType_I_STATEMENT_Typing" name="I_STATEMENT:typing_not_required" type="string" required="false"></activiti:formProperty>
      </extensionElements>
    </startEvent>
    <endEvent id="endeventOuter" name="End"></endEvent>
    <receiveTask id="receivetaskWaitForProcessPersistence" name="Wait for process Persistence"></receiveTask>
    <serviceTask id="servicetaskLoadQueus" name="Load Queues" activiti:expression="#{documentQueueSetter.execute(execution)}"></serviceTask>
    <sequenceFlow id="flow47" name="Need to Process more Queue changes" sourceRef="catchNeedToGotoNextStageError" targetRef="subprocess1"></sequenceFlow>
    <sequenceFlow id="flow51" name="" sourceRef="subprocess1" targetRef="endeventOuter"></sequenceFlow>
    <sequenceFlow id="flow52" name="" sourceRef="starteventOuter" targetRef="receivetaskWaitForProcessPersistence"></sequenceFlow>
    <sequenceFlow id="flow54" name="" sourceRef="receivetaskWaitForProcessPersistence" targetRef="servicetaskLoadQueus"></sequenceFlow>
    <sequenceFlow id="flow56" name="" sourceRef="servicetaskLoadQueus" targetRef="subprocess1"></sequenceFlow>
  </process>

Outcomes