you should not attempt to access process variables from within task listener. You should only rely on what variables given task instance has to avoid any tight coupling and inconsistent state. So make sure you pass process variables to the task and then you will not need to look up process instance.
I would like to add one additional value too ALL tasks, when they are created (the concrete value is different from task to task).I replaced org.jbpm.services.task.impl.model.TaskImpl by my own class in the persistence.xml
What would you suggest to accomplish this?
A second point: How is it possible to get access to the task variables in the taskevent listner?
List<Comment> comments = userTaskService.getCommentsByTaskId(event.getTask().getId());
results in :
[org.jbpm.services.task.persistence.TaskTransactionInterceptor] (default task-25) Could not commit session: org.jbpm.services.api.TaskNotFoundException: Task with id 84 was not found.