cancel
Showing results for 
Search instead for 
Did you mean: 

ActivitiException: Variable usuarios' is not a Collection

cantwait
Champ in-the-making
Champ in-the-making
Hello Everbody My name is Rafael Cadenas I'm from Venezuela, now I'm moving to Activiti 5.x from jBPM3.x and of course been testing the engine. Right now I'm facing the problem:

org.activiti.engine.ActivitiException: Variable usuarios' is not a Collection

Basically I'm trying to recreate the scenario where multiple instances of a task are created setting a list of three users to it.

This is my configuration…

The Process BPMN

<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="Process-test" name="process-test">
    <documentation>Place documentation for the 'process-test' process here.</documentation>
    <startEvent id="startevent1" name="Start"></startEvent>
    <userTask id="sayHelloTask" name="Hello Activiti" activiti:assignee="Rafael">
      <extensionElements>
        <activiti:taskListener event="create" class="com.odebrecht.activiti.assigment.MultiInstanceAssigment"></activiti:taskListener>
      </extensionElements>
      <multiInstanceLoopCharacteristics isSequential="false">
        <loopDataInputRef>usuarios</loopDataInputRef>
        <inputDataItem name="${assignee}"></inputDataItem>
      </multiInstanceLoopCharacteristics>
    </userTask>
    <sequenceFlow id="flow1" name="" sourceRef="startevent1" targetRef="sayHelloTask"></sequenceFlow>
    <endEvent id="endevent1" name="End"></endEvent>
    <sequenceFlow id="flow2" name="" sourceRef="sayHelloTask" targetRef="endevent1"></sequenceFlow>
  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_Process-test">
    <bpmndi:BPMNPlane bpmnElement="Process-test" id="BPMNPlane_Process-test">
      <bpmndi:BPMNShape bpmnElement="startevent1" id="BPMNShape_startevent1">
        <omgdc:Bounds height="35" width="35" x="150" y="120"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sayHelloTask" id="BPMNShape_sayHelloTask">
        <omgdc:Bounds height="55" width="105" x="290" y="110"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1">
        <omgdc:Bounds height="35" width="35" x="500" y="120"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
        <omgdi:waypoint x="185" y="137"></omgdi:waypoint>
        <omgdi:waypoint x="290" y="137"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
        <omgdi:waypoint x="395" y="137"></omgdi:waypoint>
        <omgdi:waypoint x="500" y="137"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>

The Listener…


package com.odebrecht.activiti.assigment;

import java.util.ArrayList;
import java.util.List;

import org.activiti.engine.delegate.DelegateTask;
import org.activiti.engine.delegate.TaskListener;

public class MultiInstanceAssigment implements TaskListener{

   @Override
   public void notify(DelegateTask dt) {
      ArrayList<String> usuarios = new ArrayList<String>();
      usuarios.add("rcadenas");
      usuarios.add("carlos");
      usuarios.add("yonatha");
      dt.setVariable("usuarios", usuarios);
      
   }

}

Please let me know what I am doing wrong here….
2 REPLIES 2

ronald_van_kuij
Champ on-the-rise
Champ on-the-rise
Please use the userforum…

cantwait
Champ in-the-making
Champ in-the-making
Ok, sorry about that…