Hi Tijs,
Thank you for the replay.
I have checked data base, there is a entry created in ACT_RU_VARIABLE table with name contacts.
In my case, Multi Instance will create 2 instances (As Collection is of size 2)
I have enabled debug logs of activiti,
please find below lines of logs from activiti, It might help you to understand my problem.
2016-08-29 12:23:47 [SimpleAsyncTaskExecutor-6] DEBUG o.a.e.i.b.b.MultiInstanceActivityBehavior - Multi-instance 'Activity(sid-529216C6-05D3-48E2-BB15-4B52B351B60D)' instance completed. Details: loopCounter=1, nrOrCompletedInstances=2,nrOfActiveInstances=0,nrOfInstances=2
2016-08-29 12:23:47 [SimpleAsyncTaskExecutor-6] DEBUG o.a.e.i.p.entity.ExecutionEntity - inactive concurrent executions in 'Activity(sid-529216C6-05D3-48E2-BB15-4B52B351B60D)': [ConcurrentExecution[22565], ConcurrentExecution[22566]]
2016-08-29 12:23:47 [SimpleAsyncTaskExecutor-6] DEBUG o.a.e.i.p.entity.ExecutionEntity - other concurrent executions: []
2016-08-29 12:23:47 [SimpleAsyncTaskExecutor-6] DEBUG o.a.e.i.p.entity.ExecutionEntity - transitions to take concurrent: [(sid-529216C6-05D3-48E2-BB15-4B52B351B60D)–sid-C75A9F40-14BD-4BB5-81CD-3A9437506123–>(sid-9AA4E29B-C9F3-451D-86D6-62F030ECCC40)]
2016-08-29 12:23:47 [SimpleAsyncTaskExecutor-6] DEBUG o.a.e.i.p.entity.ExecutionEntity - active concurrent executions: []
2016-08-29 12:23:47 [SimpleAsyncTaskExecutor-6] DEBUG o.a.e.i.b.b.MultiInstanceActivityBehavior - Multi-instance 'Activity(sid-529216C6-05D3-48E2-BB15-4B52B351B60D)' instance completed. Details: loopCounter=0, nrOrCompletedInstances=1,nrOfActiveInstances=1,nrOfInstances=2
2016-08-29 12:23:47 [SimpleAsyncTaskExecutor-6] DEBUG o.a.e.i.p.entity.ExecutionEntity - inactive concurrent executions in 'Activity(sid-529216C6-05D3-48E2-BB15-4B52B351B60D)': [ConcurrentExecution[22565]]
2016-08-29 12:23:47 [SimpleAsyncTaskExecutor-6] DEBUG o.a.e.i.p.entity.ExecutionEntity - other concurrent executions: []
2016-08-29 12:23:47 [SimpleAsyncTaskExecutor-6] DEBUG o.a.e.i.p.e.V.selectVariablesByExecutionId - ==> Preparing: select * from ACT_RU_VARIABLE where EXECUTION_ID_ = ? and TASK_ID_ is null
2016-08-29 12:23:47 [SimpleAsyncTaskExecutor-6] DEBUG o.a.e.i.p.e.V.selectVariablesByExecutionId - ==> Parameters: 22566(String)
2016-08-29 12:23:47 [SimpleAsyncTaskExecutor-6] DEBUG o.a.e.i.p.e.V.selectVariablesByExecutionId - <== Total: 0
2016-08-29 12:23:47 [SimpleAsyncTaskExecutor-6] DEBUG o.a.e.i.p.entity.ExecutionEntity - activating the concurrent root ScopeExecution[22560] as the single path of execution going forward
2016-08-29 12:23:47 [SimpleAsyncTaskExecutor-6] DEBUG o.a.e.i.h.DefaultHistoryManager - Current history level: AUDIT, level required: ACTIVITY
2016-08-29 12:23:47 [SimpleAsyncTaskExecutor-6] DEBUG o.a.e.i.p.r.AtomicOperationTransitionDestroyScope - destroy scope: scoped ScopeExecution[22560] continues as parent scope ProcessInstance[22552]
2016-08-29 12:23:47 [SimpleAsyncTaskExecutor-6] DEBUG o.a.e.i.p.entity.ExecutionEntity - destroying ScopeExecution[22560]
2016-08-29 12:23:47 [SimpleAsyncTaskExecutor-6] DEBUG o.a.e.i.p.r.AtomicOperationTransitionDestroyScope - destroy scope: scoped ScopeExecution[22560] continues as parent scope ProcessInstance[22552]
2016-08-29 12:23:47 [SimpleAsyncTaskExecutor-6] DEBUG o.a.e.i.p.entity.ExecutionEntity - destroying ScopeExecution[22560]
2016-08-29 12:23:47 [SimpleAsyncTaskExecutor-6] DEBUG o.a.e.i.h.DefaultHistoryManager - Current history level: AUDIT, level required: ACTIVITY
2016-08-29 12:23:47 [SimpleAsyncTaskExecutor-6] DEBUG o.a.e.i.h.DefaultHistoryManager - Current history level: AUDIT, level required: ACTIVITY
2016-08-29 12:23:47 [SimpleAsyncTaskExecutor-6] DEBUG o.a.e.i.h.DefaultHistoryManager - Current history level: AUDIT, level required: ACTIVITY
2016-08-29 12:23:47 [SimpleAsyncTaskExecutor-6] DEBUG o.a.e.i.h.DefaultHistoryManager - Current history level: AUDIT, level required: ACTIVITY
2016-08-29 12:23:47 [SimpleAsyncTaskExecutor-6] DEBUG o.a.engine.impl.db.DbSqlSession - skipping redundant delete: VariableInstanceEntity[id=22564, name=nrOfActiveInstances, type=integer, longValue=0, textValue=0]
2016-08-29 12:23:47 [SimpleAsyncTaskExecutor-6] DEBUG o.a.e.i.h.DefaultHistoryManager - Current history level: AUDIT, level required: ACTIVITY
2016-08-29 12:23:47 [SimpleAsyncTaskExecutor-6] DEBUG o.a.engine.impl.db.DbSqlSession - skipping redundant delete: VariableInstanceEntity[id=22562, name=nrOfInstances, type=integer, longValue=2, textValue=2]
2016-08-29 12:23:47 [SimpleAsyncTaskExecutor-6] DEBUG o.a.e.i.h.DefaultHistoryManager - Current history level: AUDIT, level required: ACTIVITY
2016-08-29 12:23:47 [SimpleAsyncTaskExecutor-6] DEBUG o.a.engine.impl.db.DbSqlSession - skipping redundant delete: VariableInstanceEntity[id=22563, name=nrOfCompletedInstances, type=integer, longValue=2, textValue=2]
2016-08-29 12:23:47 [SimpleAsyncTaskExecutor-6] DEBUG o.a.e.i.p.r.AtomicOperationTransitionNotifyListenerTake - ProcessInstance[22552] takes transition (sid-529216C6-05D3-48E2-BB15-4B52B351B60D)–sid-C75A9F40-14BD-4BB5-81CD-3A9437506123–>(sid-9AA4E29B-C9F3-451D-86D6-62F030ECCC40)
2016-08-29 12:23:47 [SimpleAsyncTaskExecutor-6] DEBUG o.a.e.i.h.DefaultHistoryManager - Current history level: AUDIT, level required: ACTIVITY
2016-08-29 12:23:47 [SimpleAsyncTaskExecutor-6] DEBUG o.a.engine.impl.db.DbSqlSession - skipping redundant delete: VariableInstanceEntity[id=22557, name=contacts, type=jpa-entity-list, textValue=com.fealti.data.accounts.Contact]
2016-08-29 12:23:47 [SimpleAsyncTaskExecutor-6] DEBUG o.a.e.i.p.e.T.selectTasksByExecutionId - ==> Preparing: select distinct T.* from ACT_RU_TASK T where T.EXECUTION_ID_ = ?
2016-08-29 12:23:47 [SimpleAsyncTaskExecutor-6] DEBUG o.a.e.i.p.e.T.selectTasksByExecutionId - ==> Parameters: 22552(String)
2016-08-29 12:23:47 [SimpleAsyncTaskExecutor-6] DEBUG o.a.e.i.p.e.T.selectTasksByExecutionId - <== Total: 0
2016-08-29 12:23:47 [SimpleAsyncTaskExecutor-6] DEBUG o.a.e.i.p.e.J.selectJobsByExecutionId - ==> Preparing: select * from ACT_RU_JOB J where J.EXECUTION_ID_ = ?
2016-08-29 12:23:47 [SimpleAsyncTaskExecutor-6] DEBUG o.a.e.i.p.e.J.selectJobsByExecutionId - ==> Parameters: 22552(String)
2016-08-29 12:23:47 [SimpleAsyncTaskExecutor-6] DEBUG o.a.e.i.p.e.J.selectJobsByExecutionId - <== Total: 1
2016-08-29 12:23:47 [SimpleAsyncTaskExecutor-6] DEBUG o.a.e.i.p.e.I.selectIdentityLinksByProcessInstance - ==> Preparing: select * from ACT_RU_IDENTITYLINK where PROC_INST_ID_ = ?
2016-08-29 12:23:47 [SimpleAsyncTaskExecutor-6] DEBUG o.a.e.i.p.e.I.selectIdentityLinksByProcessInstance - ==> Parameters: 22552(String)
2016-08-29 12:23:47 [SimpleAsyncTaskExecutor-6] DEBUG o.a.e.i.p.e.I.selectIdentityLinksByProcessInstance - <== Total: 0
2016-08-29 12:23:47 [SimpleAsyncTaskExecutor-6] DEBUG o.a.e.i.interceptor.CommandContext - Error while closing command context
org.activiti.engine.ActivitiIllegalArgumentException: Variable contacts is not found
at org.activiti.engine.impl.bpmn.behavior.MultiInstanceActivityBehavior.resolveNrOfInstances(MultiInstanceActivityBehavior.java:143)
at org.activiti.engine.impl.bpmn.behavior.MultiInstanceActivityBehavior.execute(MultiInstanceActivityBehavior.java:97)
at org.activiti.engine.impl.pvm.runtime.AtomicOperationActivityExecute.execute(AtomicOperationActivityExecute.java:60)
at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:97)