I try to use LocalHumanTaskService,
WorkHandler handler = new WorkHandler(ksession ,LocalHumanTaskService.getTaskService(ksession));
ksession.getWorkItemManager().registerWorkItemHandler("Human Task", handler);
if (params.isEmpty()) {
return ksession.startProcess(processId);
} else {
return ksession.startProcess(processId, params);
}
but I got new exception:
Cannot find named query UnescalatedDeadlines...
but in the Taskorm.xml, it has!
I think the reason is that service needs use only one persistence-unit.
After that, I combinated the human task persistence and processinstance. It solved.
It is very strange!