BpmnError在激活中不起作用

时间:2018-08-29 08:19:32

标签: java activiti

我在bpmn2图中使用boundaryerror。将图中的boundaryerror添加到serviceTask,然后绘制从boundaryerror到userTask的流程。 我在try_catch中抛出了bpmnError,并抛出了此异常,但是activiti并没有进入与errorBoundry相关的userTask。

以下链接中存在图

https://www.dropbox.com/s/b5o33i1v645mx23/MyProcess.jpg?dl=0

在serviceTask类中:

    //  in ServiceTask class
    try
    {
        // some functionality .....

    }
    catch (Exception e)
    {
        throw new BpmnError(null, e.getMessage());
    }

1 个答案:

答案 0 :(得分:3)

//  in ServiceTask class
try
{
    // some functionality .....

}
catch (Exception e)
{
    throw new BpmnError(null, e.getMessage());
}

错误代码中抛出新的BpmnError(null,e.getMessage());不能为null,所以我使用下面的代码

throw new BpmnError("ERROR_CODE", e.getMessage());