Search code examples
jsfcdibpmncamunda

How to handle ProcessEngineCdiException "Cannot resume task with id ..."


It may happen that the user wants to start a task that no longer exists. Then the user trigger a exception.

   ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/qed].[Faces Servlet]] (http-localhost/127.0.0.1:8080-5) JBWEB000236: Servlet.service() for servlet Faces Servlet threw exception: org.camunda.bpm.engine.cdi.ProcessEngineCdiException: Cannot resume task with id 'a4291177-f7ba-11e4-90b2-62ef20524153', no such task.
    at org.camunda.bpm.engine.cdi.BusinessProcess.startTask(BusinessProcess.java:294) [camunda-engine-cdi-7.2.0.jar:7.2.0]
    at org.camunda.bpm.engine.cdi.BusinessProcess.startTask(BusinessProcess.java:313) [camunda-engine-cdi-7.2.0.jar:7.2.0]
...

How can I handle those exceptions? I use the embedded camunda engine with JSF forms.


Solution

  • This is not really camunda specific. If your UI is talking to a system that might fail or has illegal states, you have to catch the exception and display something useful for the enduser and/or check the precondition (task exists) before even allowing the UI operation.

    In case of camunda, this can be achieved by keeping the tasklist up to date (server push, auto update) and checking the existence of the task before associating it with the camunda cdi context.