When I am using TaskService, I want to obtain the user’s task list information, but he reported an error. He reminded
2024-12-19 17:33:58.347 WARN 29056 --- [nio-8081-exec-4] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.http.converter.HttpMessageNotWritableException: Could not write JSON: Cannot invoke "org.camunda.bpm.engine.impl.interceptor.CommandContext.getExecutionManager()" because the return value of "org.camunda.bpm.engine.impl.context.Context.getCommandContext()" is null; nested exception is com.fasterxml.jackson.databind.JsonMappingException: Cannot invoke "org.camunda.bpm.engine.impl.interceptor.CommandContext.getExecutionManager()" because the return value of "org.camunda.bpm.engine.impl.context.Context.getCommandContext()" is null (through reference chain: java.util.ArrayList[0]->org.camunda.bpm.engine.impl.persistence.entity.TaskEntity["execution"])]
My code is as follows:
import org.camunda.bpm.engine.TaskService;
import org.camunda.bpm.engine.task.Task;
@Autowired
private TaskService taskService;
/**
* Query the task list of a user
*
* @param userName user name
* @return task c
*/
@GetMapping
public List<Task> findUserTask(@RequestParam String userName) {
return taskService.createTaskQuery().taskAssignee(userName).list();
}