[jboss-user] [jBPM] - taskId of user task is cumulating

Thomas Colditz do-not-reply at jboss.com
Thu Jul 18 10:21:12 EDT 2013

Thomas Colditz [https://community.jboss.org/people/fellowtom] created the discussion

"taskId of user task is cumulating"

To view the discussion, visit: https://community.jboss.org/message/828650#828650

Hi all,

this is my first post here, since I'm pretty new with jbpm and bpm in general. Installation worked fine and trying one of the example processes is fine as well.
So I tried to set up my own process wich just consists of Start->script->user->script->end, to get a little "deeper" training. The code is (almost) the same compared to EvaluationExample2.
But I just wanted to complete 1 user task, no gateways or anything else. Long sentence short, it works fine ONCE. 
Im using jBPM 6. Here's the code:

public static void main(String[] args) throws Exception{
                    RuntimeManager manager = getRuntimeManager("process_1.bpmn");        
                    RuntimeEngine runtime = manager.getRuntimeEngine(EmptyContext.get());
                    KieSession ksession = runtime.getKieSession();
                // start a new process instance
                    Map<String, Object> params = new HashMap<String, Object>();
                    params.put("worker", "user1");
                    ksession.startProcess("process_1.bpmn", params); 
                // the first task
                    TaskService tser = runtime.getTaskService();
                    TaskSummary tsum = taskService.getTaskAssignedAsPotentialOwner("user1", "en-UK").get(0);
                taskService.start(tsum.getId(), "user1");
                    taskService.complete(tsum.getId(), "user1", null);
               } catch (Throwable t) {
               private static RuntimeManager getRuntimeManager(String process) {
                    // load up the knowledge base
                       Properties properties= new Properties();
                    properties.setProperty("krisv", "");
                    properties.setProperty("mary", "HR");
                    properties.setProperty("john", "PM");
                    UserGroupCallback userGroupCallback = new JBossUserGroupCallbackImpl(properties);
                    RuntimeEnvironment environment = RuntimeEnvironmentBuilder.getDefault()
                         .addAsset(ResourceFactory.newClassPathResource(process), ResourceType.BPMN2)
                    return RuntimeManagerFactory.Factory.get().newSingletonRuntimeManager(environment);

The error is the following: User '[UserImpl: 'user1']' was unable to execution operation 'Start' on task id 4 due to a no 'current status' match.
So everytime I:
          - change the string of employee (e.g. "user1" to "user2"), it works ONCE again, but the taskId is summating (every time I try to run, its getting taskId++;). BTW the taskId should be 4. 
          - delete the jbpm-db.h2.db, it works fine again ONCE, but the taskId starts at 1. 
          - run the EvaluationExample2 in between, I can run my process again once. A second time fails (Example runs multiple times), but taskId is always 4 like it should. So this seems to 'reset' my problem.

So I hope I could explain my Problem and I'm sure its a very simple one for you. (probably just a db setup)

With kind regards!

Reply to this message by going to Community

Start a new discussion in jBPM at Community

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20130718/3262e455/attachment.html 

More information about the jboss-user mailing list