BPMN Error in java ee

Hi everyone,

I’m trying to throw a BPMN in java EE, I read this Error Events | docs.camunda.org and Delegation Code | docs.camunda.org

And I throw a BPMN in my java delegate → throw new BpmnError(“PocThrowError1”);

And In the BPMN I create a error <bpmn:error id=“PocThrowError1” name=“PocThrowError1” errorCode=“PocThrowError1” /> and put it in a boundary error
<bpmn:boundaryEvent id=“BoundaryEvent_17d1tdf” attachedToRef=“Task_1huxe3x”>
bpmn:outgoingSequenceFlow_0ffrfsl</bpmn:outgoing>
<bpmn:errorEventDefinition errorRef=“PocThrowError1” />
</bpmn:boundaryEvent>

In the properties of the process engine —> true
I understand this is all i need to cath the bpmnError no?

But i have this error: Cannot instantiate process definition PocErrorNacho:1:9ecac7ee-759f-11e9-98f8-38dead6ca08a: ENGINE-02042 Execution with id ‘Task_113tjh4’ throws an error event with errorCode ‘PocThrowError1’, but no error handler was defined.

And another question Is possible doesn’t put any errorCode in the boundary to Catch all or the different BPMNError i thrown?

Thanks in advace,
Best regards,
Ignacio

Hi @Ignacio_Requena_Elvi,

the engine complains about a different Task

than you described:

Could you please post the complete model?

Cheers, Ingo

1 Like

True, I dont see it. I put the boundary in incorrect position.

But now I have this error → Cannot instantiate process definition PocErrorNacho:1:c7e3e720-7625-11e9-8e3d-38dead6ca08a: ENGINE-02033 Delegate Expression ‘${nachoController.execute(execution)}’ did neither resolve to an implementation of ‘interface org.camunda.bpm.engine.impl.pvm.delegate.ActivityBehavior’ nor 'interface org.camunda.bpm.engine.delegate.JavaDelegate

PocErrorNacho.bpmn (5.2 KB)

Hi @Ignacio_Requena_Elvi,

your implementation should be an expression rather than a delegate expression.

Hope this helps, Ingo

1 Like

Hi @Ingo_Richtsmeier,

I put a expression rather a delegate expression PocErrorNacho.bpmn (5.2 KB)
and now →

11:37:43,141 ERROR [org.jboss.as.ejb3.invocation] (default task-26) WFLYEJB0034: EJB Invocation failed on component PruebaPenque for method public abstract void org.camunda.bpm.engine.delegate.JavaDelegate.execute(org.camunda.bpm.engine.delegate.DelegateExecution) throws java.lang.Exception: javax.ejb.EJBTransactionRolledbackException.
.
.
.
Caused by: org.camunda.bpm.engine.delegate.BpmnError (errorCode=‘PocThrowError1’)

It’s like the boundary doesn’t catch the error.

Hi @Ignacio_Requena_Elvi,

when your service call exception sets the rollBackOnly flag on the transaction, Wildfly will rollback everything and outvote the process engine.

You have to spawn a new transaction to encapsulate your EJB call and give the engine a chance to continue with the BPMN error handling.

I’ve done this a long time ago, but can’t remember any details about this. Google should help you further.

Hope this helps, Ingo

1 Like