AnsweredAssumed Answered

ActivitiException: userId is null after transferring task

Question asked by mindcrime on Mar 20, 2013
Latest reply on Mar 21, 2013 by mindcrime
Hey guys, using Activiti 5.10, I'm seeing some hard to explain weirdness.  If I, in Java code, transfer a UserTask
to a different user, doing something like this:


      List<Task> tasks = taskService.createTaskQuery().taskCandidateGroup("management").list();
      
      System.out.println( "for management: ");
      for( Task task : tasks )
      {
         System.out.println( "task: " + task.toString() );

         taskService.setOwner(task.getId(), "gonzo" );
         taskService.setAssignee(task.getId(), "gonzo");

      }


everything appears to work, initially.  No errors are thrown in the above code, and I can examine the task in the db table and
see the correct values for Owner and Assignee.  And if I login to Activiti Explorer as Gonzo, I now see the task in
my inbox.  But…  Gonzo can't actually do anything with the task (like, say, complete it).  Nothing happens if he clicks
on the Task item, and the following error is shown in the console when the page was originally rendered:


Caused by: org.activiti.engine.ActivitiException: userId is null
   at org.activiti.engine.impl.cmd.GetUserPictureCmd.execute(GetUserPictureCmd.java:39)
   at org.activiti.engine.impl.cmd.GetUserPictureCmd.execute(GetUserPictureCmd.java:28)
   at org.activiti.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)
   at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:42)
   at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:42)
   at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)
   at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:40)
   at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
   at org.activiti.engine.impl.IdentityServiceImpl.getUserPicture(IdentityServiceImpl.java:102)
   at org.activiti.explorer.ui.task.TaskEventsPanel.addTaskEventPicture(TaskEventsPanel.java:134)
   at org.activiti.explorer.ui.task.TaskEventsPanel.addTaskEvents(TaskEventsPanel.java:127)
   at org.activiti.explorer.ui.task.TaskEventsPanel.refreshTaskEvents(TaskEventsPanel.java:93)
   at org.activiti.explorer.ui.task.TaskEventsPanel.setTaskId(TaskEventsPanel.java:102)
   at org.activiti.explorer.ui.task.TaskPage.createDetailComponent(TaskPage.java:132)
   at org.activiti.explorer.ui.task.TaskPage$1.valueChange(TaskPage.java:116)
   at sun.reflect.GeneratedMethodAccessor115.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:616)
   at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:490)


Does anyone have any idea what's going on here?  Is there something I need to do differently when I transfer the Task?  Also, FYI, doing the
ownership change and assignment simultaneously is a business requirement.  They want the act of transferring a task to automatically assign
it to the new owner.

Outcomes