AnsweredAssumed Answered

java.util.ConcurrentModificationException

Question asked by masahirotomoda on Sep 30, 2016
Latest reply on Oct 2, 2016 by masahirotomoda
hi
Im Masahiro Tomoda. Japanese Website Engineer.

Plz teach me about this trouble.

why exception?

[Exception Program]
72:                repositoryService
73:                    .createDeployment()
74:                    .addClasspathResource(file.getName())
75:                    .deploy();

[activity.cfg.xml]
<?xml version='1.0' encoding='UTF-8'?>

<beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.springframework.org/schema/beans   http://www.springframework.org/schema/beans/spring-beans.xsd">

    <bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration" >

        <property name="databaseType" value="postgres" />
        <property name="jdbcUrl" value="jdbc:postgresql://localhost:5432/demo" />
        <property name="jdbcDriver" value="org.postgresql.Driver" />
        <property name="jdbcUsername" value="postgres" />
        <property name="jdbcPassword" value="XXXXXXXX" />

        <property name="databaseSchemaUpdate" value="true" />

       <property name="jobExecutorActivate" value="false" />
       <property name="asyncExecutorEnabled" value="false" />
       <property name="asyncExecutorActivate" value="false" />


        <property name="mailServerHost" value="mail.my-corp.com" />
        <property name="mailServerPort" value="5025" />
    </bean>

</beans>

[Trace log]
INFO  2016-09-30 15:29:24,176 [main] Initializing process engine using configuration 'file:/C:/Users/Masahiro/Documents/eclipse/ws/Activiti/WorkFlowDemo/build/classes/activiti.cfg.xml'
INFO  2016-09-30 15:29:24,178 [main] initializing process engine for resource file:/C:/Users/Masahiro/Documents/eclipse/ws/Activiti/WorkFlowDemo/build/classes/activiti.cfg.xml
2016-09-30 15:29:24,561 [main] INFO  org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from InputStream resource [resource loaded through InputStream]
DEBUG 2016-09-30 15:29:25,428 [main] initializing datasource to db: jdbc:postgresql://localhost:5432/demo
DEBUG 2016-09-30 15:29:45,634 [main]

DEBUG 2016-09-30 15:29:45,635 [main] — starting SchemaOperationsProcessEngineBuild ——————————————————–
DEBUG 2016-09-30 15:29:46,078 [main] flush summary: 0 insert, 0 update, 0 delete.
DEBUG 2016-09-30 15:29:46,078 [main] now executing flush…
DEBUG 2016-09-30 15:29:46,078 [main] firing event committing…
DEBUG 2016-09-30 15:29:46,079 [main] committing the ibatis sql session…
DEBUG 2016-09-30 15:29:46,080 [main] firing event committed…
DEBUG 2016-09-30 15:29:46,089 [main] — SchemaOperationsProcessEngineBuild finished ——————————————————–
DEBUG 2016-09-30 15:29:46,089 [main]

INFO  2016-09-30 15:29:46,089 [main] ProcessEngine default created
INFO  2016-09-30 15:29:46,109 [main] initialised process engine default
2016-09-30 15:29:46,111 [main] INFO  jp.ecs.tool.DeploymentProcDef - ##### deploy start!
DEBUG 2016-09-30 15:29:46,153 [main]

DEBUG 2016-09-30 15:29:46,153 [main] — starting DeployCmd ——————————————————–
DEBUG 2016-09-30 15:29:46,157 [main]

DEBUG 2016-09-30 15:29:46,157 [main] — starting GetNextIdBlockCmd ——————————————————–
DEBUG 2016-09-30 15:29:46,232 [main]   update PropertyEntity[name=next.dbid, value=45001]
DEBUG 2016-09-30 15:29:46,232 [main] flush summary: 0 insert, 1 update, 0 delete.
DEBUG 2016-09-30 15:29:46,232 [main] now executing flush…
DEBUG 2016-09-30 15:29:46,232 [main] updating: PropertyEntity[name=next.dbid, value=45001]
DEBUG 2016-09-30 15:29:46,239 [main] firing event committing…
DEBUG 2016-09-30 15:29:46,240 [main] committing the ibatis sql session…
DEBUG 2016-09-30 15:29:46,261 [main] firing event committed…
DEBUG 2016-09-30 15:29:46,262 [main] — GetNextIdBlockCmd finished ——————————————————–
DEBUG 2016-09-30 15:29:46,262 [main]

DEBUG 2016-09-30 15:29:46,263 [main] Processing deployment null
INFO  2016-09-30 15:29:46,264 [main] Processing resource DemoProcess1.bpmn
DEBUG 2016-09-30 15:29:46,950 [main] Parsing process vacationRequest
DEBUG 2016-09-30 15:29:46,951 [main] Parsing activity handleRequest
DEBUG 2016-09-30 15:29:47,000 [main] Parsing activity requestApprovedDecision
DEBUG 2016-09-30 15:29:47,003 [main] Parsing activity sendApprovalMail
DEBUG 2016-09-30 15:29:47,004 [main] Parsing activity adjustVacationRequestTask
DEBUG 2016-09-30 15:29:47,005 [main] Parsing activity resendRequestDecision
DEBUG 2016-09-30 15:29:47,006 [main] Parsing activity request
DEBUG 2016-09-30 15:29:47,008 [main] Parsing activity theEnd1
DEBUG 2016-09-30 15:29:47,009 [main] Parsing activity theEnd2
DEBUG 2016-09-30 15:29:47,024 [main]

DEBUG 2016-09-30 15:29:47,024 [main] — starting GetProcessDefinitionInfoCmd ——————————————————–
DEBUG 2016-09-30 15:29:47,024 [main] Valid context found. Reusing it for the current command 'org.activiti.engine.impl.cmd.GetProcessDefinitionInfoCmd'
DEBUG 2016-09-30 15:29:47,025 [main] — GetProcessDefinitionInfoCmd finished ——————————————————–
DEBUG 2016-09-30 15:29:47,025 [main]

DEBUG 2016-09-30 15:29:47,025 [main]   insert DeploymentEntity[id=42501, name=null]
DEBUG 2016-09-30 15:29:47,025 [main]   insert ResourceEntity[id=42502, name=DemoProcess1.bpmn]
DEBUG 2016-09-30 15:29:47,026 [main]   insert ProcessDefinitionEntity[vacationRequest:1:42503]
DEBUG 2016-09-30 15:29:47,026 [main] flush summary: 3 insert, 0 update, 0 delete.
DEBUG 2016-09-30 15:29:47,026 [main] now executing flush…
DEBUG 2016-09-30 15:29:47,026 [main] inserting: ProcessDefinitionEntity[vacationRequest:1:42503]
DEBUG 2016-09-30 15:29:47,038 [main] inserting: DeploymentEntity[id=42501, name=null]
DEBUG 2016-09-30 15:29:47,041 [main] inserting: ResourceEntity[id=42502, name=DemoProcess1.bpmn]
DEBUG 2016-09-30 15:29:47,049 [main] Error while closing command context
java.util.ConcurrentModificationException
   at java.util.HashMap$HashIterator.nextNode(HashMap.java:1429)
   at java.util.HashMap$ValueIterator.next(HashMap.java:1458)
   at org.activiti.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:211)
   at org.activiti.engine.impl.interceptor.CommandContext.close(CommandContext.java:138)
   at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:66)
   at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:37)
   at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:40)
   at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:35)
   at org.activiti.engine.impl.RepositoryServiceImpl.deploy(RepositoryServiceImpl.java:79)
   at org.activiti.engine.impl.repository.DeploymentBuilderImpl.deploy(DeploymentBuilderImpl.java:156)
   at jp.ecs.tool.DeploymentProcDef.main(DeploymentProcDef.java:74)
DEBUG 2016-09-30 15:29:47,051 [main] firing event rolling back…
DEBUG 2016-09-30 15:29:47,051 [main] rolling back ibatis sql session…
DEBUG 2016-09-30 15:29:47,053 [main] firing event rolled back…
DEBUG 2016-09-30 15:29:47,053 [main] — DeployCmd finished ——————————————————–
DEBUG 2016-09-30 15:29:47,053 [main]

[bpmn]
<?xml version="1.0" encoding="UTF-8" ?>
<definitions id="definitions"
             targetNamespace="http://activiti.org/bpmn20"
             xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xmlns:activiti="http://activiti.org/bpmn">

  <process id="vacationRequest" name="Vacation request">

    <startEvent id="request" activiti:initiator="employeeName">
      <extensionElements>
        <activiti:formProperty id="numberOfDays" name="Number of days" type="long" value="1" required="true"/>
        <activiti:formProperty id="startDate" name="First day of holiday (dd-MM-yyy)" datePattern="dd-MM-yyyy hh:mm" type="date" required="true" />
        <activiti:formProperty id="vacationMotivation" name="Motivation" type="string" />
      </extensionElements>
    </startEvent>
    <sequenceFlow id="flow1" sourceRef="request" targetRef="handleRequest" />

    <userTask id="handleRequest" name="Handle vacation request" >
      <documentation>
        ${employeeName} would like to take ${numberOfDays} day(s) of vacation (Motivation: ${vacationMotivation}).
      </documentation>
      <extensionElements>
         <activiti:formProperty id="vacationApproved" name="Do you approve this vacation" type="enum" required="true">
          <activiti:value id="true" name="Approve" />
          <activiti:value id="false" name="Reject" />
        </activiti:formProperty>
        <activiti:formProperty id="managerMotivation" name="Motivation" type="string" />
      </extensionElements>
      <potentialOwner>
        <resourceAssignmentExpression>
          <formalExpression>management</formalExpression>
        </resourceAssignmentExpression>
      </potentialOwner>
    </userTask>
    <sequenceFlow id="flow2" sourceRef="handleRequest" targetRef="requestApprovedDecision" />

    <exclusiveGateway id="requestApprovedDecision" name="Request approved?" />
    <sequenceFlow id="flow3" sourceRef="requestApprovedDecision" targetRef="sendApprovalMail">
      <conditionExpression xsi:type="tFormalExpression">${vacationApproved == 'true'}</conditionExpression>
    </sequenceFlow>

    <task id="sendApprovalMail" name="Send confirmation e-mail" />
    <sequenceFlow id="flow4" sourceRef="sendApprovalMail" targetRef="theEnd1" />
    <endEvent id="theEnd1" />

    <sequenceFlow id="flow5" sourceRef="requestApprovedDecision" targetRef="adjustVacationRequestTask">
      <conditionExpression xsi:type="tFormalExpression">${vacationApproved == 'false'}</conditionExpression>
    </sequenceFlow>

    <userTask id="adjustVacationRequestTask" name="Adjust vacation request">
      <documentation>
        Your manager has disapproved your vacation request for ${numberOfDays} days.
        Reason: ${managerMotivation}
      </documentation>
      <extensionElements>
        <activiti:formProperty id="numberOfDays" name="Number of days" value="${numberOfDays}" type="long" required="true"/>
        <activiti:formProperty id="startDate" name="First day of holiday (dd-MM-yyy)" value="${startDate}" datePattern="dd-MM-yyyy hh:mm" type="date" required="true" />
        <activiti:formProperty id="vacationMotivation" name="Motivation" value="${vacationMotivation}" type="string" />
        <activiti:formProperty id="resendRequest" name="Resend vacation request to manager?" type="enum" required="true">
          <activiti:value id="true" name="Yes" />
          <activiti:value id="false" name="No" />
        </activiti:formProperty>
      </extensionElements>
      <humanPerformer>
        <resourceAssignmentExpression>
          <formalExpression>${employeeName}</formalExpression>
        </resourceAssignmentExpression>
      </humanPerformer>
    </userTask>
    <sequenceFlow id="flow6" sourceRef="adjustVacationRequestTask" targetRef="resendRequestDecision" />

    <exclusiveGateway id="resendRequestDecision" name="Resend request?" />
    <sequenceFlow id="flow7" sourceRef="resendRequestDecision" targetRef="handleRequest">
      <conditionExpression xsi:type="tFormalExpression">${resendRequest == 'true'}</conditionExpression>
    </sequenceFlow>

     <sequenceFlow id="flow8" sourceRef="resendRequestDecision" targetRef="theEnd2">
      <conditionExpression xsi:type="tFormalExpression">${resendRequest == 'false'}</conditionExpression>
    </sequenceFlow>
    <endEvent id="theEnd2" />

  </process>

</definitions>

Outcomes