Search code examples
javajbossjbpmbpmn

No query defined for that name [getAuditTaskById]


When I tried to start a task using taskService.start(task.getId(), "krisv");, I get No query defined for that name [getAuditTaskById]. The bpmn file is very similar to the Evaluation.bpmn file. My current version of jbpmn is 6.2.

The code snippet is the following:

List<TaskSummary> tasks = taskService.getTasksAssignedAsPotentialOwner("krisv", "en-UK");
if (tasks.size() > 0) {
    TaskSummary task = tasks.get(0);
    System.out.println("Task id: " + task.getId());
    System.out.println("'krisv' completing task " + task.getName() + ": " + task.getDescription());
    System.out.println("Task status: " + task.getStatus().name());
    System.out.println("Potential owners: " + task.getActualOwner().getId());
    taskService.start(task.getId(), "krisv");
    Map<String, Object> results = new HashMap<String, Object>();
    results.put("performance", "exceeding");
    taskService.complete(task.getId(), "krisv", results);
    System.out.println("Completed task");
} else {
    System.out.println("No tasks!");
}

The code above is almost a replicate of the ProcessTest.java file in the sample folder. The ProcessTest.java allows the completion of the tasks, but the exact same code doesn't in my custom java file.

Also, the current task's status is "reserved" if that is of any help. Thanks!


Solution

  • The query is defined in the jbpm-human-task-audit-audit jar, you need that on your classpath: https://github.com/droolsjbpm/jbpm/blob/6.2.0.Final/jbpm-human-task/jbpm-human-task-audit/src/main/resources/META-INF/TaskAuditorm.xml#L40

    And you need to make sure this file is referenced in your persistence.xml, like for example here: https://github.com/droolsjbpm/jbpm/blob/6.2.0.Final/jbpm-test/src/main/resources/META-INF/persistence.xml#L15