cancel
Showing results for 
Search instead for 
Did you mean: 

ActivitiException: userId is null after transferring task

mindcrime
Champ in-the-making
Champ in-the-making
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.
4 REPLIES 4

mindcrime
Champ in-the-making
Champ in-the-making
Also, in case it helps…  I can do stuff like this, after doing the transfer:


  List<Task> gonzoTasks = taskService.createTaskQuery().taskOwner("gonzo").list();
  System.out.println( "for gonzo: ");
  for( Task task : gonzoTasks )
  {
   System.out.println( "task: " + task.toString() );
   System.out.println( "Owner: " + task.getOwner() );
   System.out.println( "Assignee: " + task.getAssignee());
  } 

and it works as expected:


for gonzo:
task: Task[6311]
Owner: gonzo
Assignee: gonzo

mindcrime
Champ in-the-making
Champ in-the-making
Also, FYI, I can complete the task programmatically like this:


  List<Task> gonzoTasks = taskService.createTaskQuery().taskOwner("gonzo").list();
  System.out.println( "for gonzo: ");
  for( Task task : gonzoTasks )
  {
   System.out.println( "task: " + task.toString() );
   System.out.println( "Owner: " + task.getOwner() );
   System.out.println( "Assignee: " + task.getAssignee());
 
   taskService.complete(task.getId());
 
  }

and now, if I login as Gonzo, the task has moved from Inbox to Archived as expected, and if I examine the tables, everything looks right.  But, still, when rendering the Archived page, I get that same exception as above:


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.ArchivedPage.createDetailComponent(ArchivedPage.java:55)
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)
… 46 more

frederikherema1
Star Contributor
Star Contributor
Looks like the person who cause the event (set the owner) is null.
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)

Try adding Authentication.setUser (or currentUser, not sure what the exact syntax is) before setting the owner and assignee. This way, explorer will be able to render an image for the event. However, it's an issue that in case of null-userid, an exception is thrown. Can you file a jIra for this issue perhaps?

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

mindcrime
Champ in-the-making
Champ in-the-making
Looks like the person who cause the event (set the owner) is null.
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)

Try adding Authentication.setUser (or currentUser, not sure what the exact syntax is) before setting the owner and assignee. This way, explorer will be able to render an image for the event.

OK, I'll give that a try.

However, it's an issue that in case of null-userid, an exception is thrown. Can you file a jIra for this issue perhaps?

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

OK, no problem.
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.