cancel
Showing results for 
Search instead for 
Did you mean: 

ActivitiObjectNotFoundException

risto45
Champ in-the-making
Champ in-the-making
I have the following code, which throws "org.activiti.engine.ActivitiObjectNotFoundException: task 1298828 doesn't exist". If taskService.createTaskQuery() returns a task, how can taskService.getVariableLocal() say milliseconds later that such task doesn't exist? Any ideas?

List<Task> tasks = taskService.createTaskQuery().taskAssignee(user.getName()).list();
for (Task task : tasks) {
    notified = (Boolean) taskService.getVariableLocal(task.getId(), "notified");
}
1 REPLY 1

frederikherema1
Star Contributor
Star Contributor
In case there is a boundary timer-event on the user-task, which deleted the task OR if another thread completed the task.

org.activiti.engine.ActivitiObjectNotFoundException is a typed exception, meant specifically for these kind of usecases… You can catch it and ignore the task, for example… If you REALLY don't want this, force your DB/transaction to have "Repeatable reads" isolation-level and ensure all API-calls are done in the same transaction if you're okay with phantom task reads (the task is gone, so the data is stale) and slower performance…