cancel
Showing results for 
Search instead for 
Did you mean: 

BPMNError, ErrorBoundryEvent and spring

abol911
Champ in-the-making
Champ in-the-making
Hi,
I have a "main diagram" that contains "call activity". "Subdiagrams" comunicates with buisness logic using the spring(in service task i use "Expression" to inject spring logic - "#{serviceCallActiviti.met5(execution)}").

In main diagram i use ErrorBoundryEvent to catch "BPMNError" from "subdiagram", but with spring it dosen't work(with JAVAdelegate everything is OK).

Mayby in ServiceTaskExpressionActivityBehavior class it can be done something like in ScriptTaskActivityBehavior in line 57
4 REPLIES 4

trademak
Star Contributor
Star Contributor
Hi,

You'll have to rephrase your question a bit. I don't understand it now.

Best regards,

abol911
Champ in-the-making
Champ in-the-making
If i run mianDiagram i get error:

Caused by: org.activiti.engine.impl.javax.el.ELException: org.activiti.engine.delegate.BpmnError:  (errorCode='ERROR')
at org.activiti.engine.impl.javax.el.BeanELResolver.invoke(BeanELResolver.java:481)
at org.activiti.engine.impl.javax.el.CompositeELResolver.invoke(CompositeELResolver.java:397)
at org.activiti.engine.impl.juel.AstMethod.invoke(AstMethod.java:91)
at org.activiti.engine.impl.juel.AstMethod.eval(AstMethod.java:75)
at org.activiti.engine.impl.juel.AstEval.eval(AstEval.java:50)
at org.activiti.engine.impl.juel.AstNode.getValue(AstNode.java:26)
at org.activiti.engine.impl.juel.TreeValueExpression.getValue(TreeValueExpression.java:114)
at org.activiti.engine.impl.delegate.ExpressionGetInvocation.invoke(ExpressionGetInvocation.java:33)
at org.activiti.engine.impl.delegate.DelegateInvocation.proceed(DelegateInvocation.java:37)
at org.activiti.engine.impl.delegate.DefaultDelegateInterceptor.handleInvocation(DefaultDelegateInterceptor.java:25)
at org.activiti.engine.impl.el.JuelExpression.getValue(JuelExpression.java:50)
… 495 more
Caused by: org.activiti.engine.delegate.BpmnError:  (errorCode='ERROR')
at pl.asseco.activiti.test.activity.ServiceCallActiviti.met5(ServiceCallActiviti.java:46)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.activiti.engine.impl.javax.el.BeanELResolver.invoke(BeanELResolver.java:479)
… 505 more
2012-03-13 09:50:41 org.activiti.engine.impl.pvm.runtime.AtomicOperationProcessEnd eventNotificationsCompleted
SEVERE: Error while completing sub process of execution ProcessInstance[8318]
org.activiti.engine.ActivitiException: Error while evalutaing expression
at org.activiti.engine.impl.el.JuelExpression.getValue(JuelExpression.java:59)
at org.activiti.engine.impl.bpmn.behavior.ServiceTaskExpressionActivityBehavior.execute(ServiceTaskExpressionActivityBehavior.java:39)
at org.activiti.engine.impl.pvm.runtime.AtomicOperationActivityExecute.execute(AtomicOperationActivityExecute.java:44)
at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:77)



According the documentation BPMNError work with JavaDelegates or scripts. If i use JAVADelegate to run businessLogic everything is ok. The BPMNError is catch by "Boundary Error Event" and go to Service TASK(main diagram).

My question is: Is there any possibility to use BPMN Error in Expression ?

I look into code and i see how this Exception is being handled in Scipts:

ScriptTaskActivityBehavior line 57

catch (ActivitiException e) {
      noErrors = false;
      if (e.getCause() instanceof ScriptException
          && e.getCause().getCause() instanceof ScriptException
          && e.getCause().getCause().getCause() instanceof BpmnError) {
        ErrorPropagation.propagateError((BpmnError) e.getCause().getCause().getCause(), execution);
      } else {
        throw e;
      }

Mayby to handle BMPNError in Expression you can add the same code to the ServiceTaskExpressionActivityBehavior

trademak
Star Contributor
Star Contributor
Hi,

Yes I think it should be possible to also add this behavior to service tasks with expressions.
Can you raise a JIRA for this? And if you can also provide a patch that would be great of course.

Best regards,