Flowable-engine in OSGi - Use of delegateExpression attribute resulting in bean not found issue


#1

Based on the information posted under Flowable-engine in OSGi - Tutorials/examples?, I have Flowable v5.23.0 (since v6.4.0 has issues over OSGi) working with Felix (v6.0.1) with:

  • a process-engine bundle (configured using blueprint)
  • a workflow-handler bundle - responsible to deploy process definitions on start and exporting a service to start process instances

When using the activiti:class attribute on a with a simple delegate class (i.e. empty execute() method), it works fine.
When using the activiti:delegateExpression attribute on the for the same delegate (with the bean defined in the workflow-handler bundle blueprint), the RuntimeService.startProcessInstanceByKey() call results in:

org.activiti.engine.ActivitiException: Unknown property used in expression: ${taskBean}
at org.activiti.engine.impl.el.JuelExpression.getValue(JuelExpression.java:53) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.bpmn.helper.DelegateExpressionUtil.resolveDelegateExpression(DelegateExpressionUtil.java:37) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.bpmn.behavior.ServiceTaskDelegateExpressionActivityBehavior.execute(ServiceTaskDelegateExpressionActivityBehavior.java:90) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.pvm.runtime.AtomicOperationActivityExecute.execute(AtomicOperationActivityExecute.java:60) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:97) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:650) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:643) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerStart.eventNotificationsCompleted(AtomicOperationTransitionNotifyListenerStart.java:52) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:56) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:97) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:650) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:643) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:49) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:97) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:650) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:643) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionCreateScope.execute(AtomicOperationTransitionCreateScope.java:49) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:97) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:650) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:643) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerTake.execute(AtomicOperationTransitionNotifyListenerTake.java:80) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:97) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:650) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:643) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionDestroyScope.execute(AtomicOperationTransitionDestroyScope.java:116) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:97) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:650) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:643) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerEnd.eventNotificationsCompleted(AtomicOperationTransitionNotifyListenerEnd.java:35) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:56) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:97) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:650) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:643) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:49) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:97) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:650) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:643) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.take(ExecutionEntity.java:460) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.take(ExecutionEntity.java:438) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.bpmn.behavior.ExclusiveGatewayActivityBehavior.leave(ExclusiveGatewayActivityBehavior.java:83) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.bpmn.behavior.FlowNodeActivityBehavior.execute(FlowNodeActivityBehavior.java:36) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.pvm.runtime.AtomicOperationActivityExecute.execute(AtomicOperationActivityExecute.java:60) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:97) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:650) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:643) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerStart.eventNotificationsCompleted(AtomicOperationTransitionNotifyListenerStart.java:52) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:56) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:97) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:650) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:643) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:49) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:97) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:650) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:643) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionCreateScope.execute(AtomicOperationTransitionCreateScope.java:49) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:97) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:650) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:643) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerTake.execute(AtomicOperationTransitionNotifyListenerTake.java:80) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:97) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:650) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:643) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionDestroyScope.execute(AtomicOperationTransitionDestroyScope.java:116) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:97) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:650) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:643) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerEnd.eventNotificationsCompleted(AtomicOperationTransitionNotifyListenerEnd.java:35) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:56) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:97) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:650) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:643) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:49) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:97) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:650) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:643) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.take(ExecutionEntity.java:460) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.take(ExecutionEntity.java:438) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.bpmn.behavior.BpmnActivityBehavior.performOutgoingBehavior(BpmnActivityBehavior.java:140) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.bpmn.behavior.BpmnActivityBehavior.performDefaultOutgoingBehavior(BpmnActivityBehavior.java:66) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.bpmn.behavior.FlowNodeActivityBehavior.leave(FlowNodeActivityBehavior.java:44) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.bpmn.behavior.AbstractBpmnActivityBehavior.leave(AbstractBpmnActivityBehavior.java:47) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.bpmn.behavior.ServiceTaskJavaDelegateActivityBehavior.execute(ServiceTaskJavaDelegateActivityBehavior.java:45) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.bpmn.helper.ClassDelegate.execute(ClassDelegate.java:155) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.pvm.runtime.AtomicOperationActivityExecute.execute(AtomicOperationActivityExecute.java:60) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:97) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:650) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:643) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerStart.eventNotificationsCompleted(AtomicOperationTransitionNotifyListenerStart.java:52) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:56) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:97) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:650) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:643) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:49) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:97) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:650) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:643) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionCreateScope.execute(AtomicOperationTransitionCreateScope.java:49) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:97) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:650) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:643) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerTake.execute(AtomicOperationTransitionNotifyListenerTake.java:80) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:97) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:650) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:643) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionDestroyScope.execute(AtomicOperationTransitionDestroyScope.java:116) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:97) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:650) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:643) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerEnd.eventNotificationsCompleted(AtomicOperationTransitionNotifyListenerEnd.java:35) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:56) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:97) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:650) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:643) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:49) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:97) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:650) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:643) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.take(ExecutionEntity.java:460) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.take(ExecutionEntity.java:438) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.bpmn.behavior.BpmnActivityBehavior.performOutgoingBehavior(BpmnActivityBehavior.java:140) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.bpmn.behavior.BpmnActivityBehavior.performDefaultOutgoingBehavior(BpmnActivityBehavior.java:66) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.bpmn.behavior.FlowNodeActivityBehavior.leave(FlowNodeActivityBehavior.java:44) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.bpmn.behavior.FlowNodeActivityBehavior.execute(FlowNodeActivityBehavior.java:36) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.pvm.runtime.AtomicOperationActivityExecute.execute(AtomicOperationActivityExecute.java:60) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:97) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:650) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:643) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.pvm.runtime.AtomicOperationProcessStartInitial.eventNotificationsCompleted(AtomicOperationProcessStartInitial.java:45) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:56) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:97) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:650) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:643) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.pvm.runtime.AtomicOperationProcessStart.eventNotificationsCompleted(AtomicOperationProcessStart.java:64) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:56) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:97) [flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:650) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:643) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.start(ExecutionEntity.java:388) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.cmd.StartProcessInstanceCmd.execute(StartProcessInstanceCmd.java:115) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.cmd.StartProcessInstanceCmd.execute(StartProcessInstanceCmd.java:37) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.interceptor.CommandInvoker.execute(CommandInvoker.java:24) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:57) [flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:31) [flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:40) [flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:35) [flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.RuntimeServiceImpl.startProcessInstanceByKey(RuntimeServiceImpl.java:82) [flowable-engine-5.23.0.jar:5.23.0]

at java.lang.Thread.run(Thread.java:745) [?:1.8.0_121]
Caused by: org.activiti.engine.impl.javax.el.PropertyNotFoundException: Cannot resolve identifier ‘calculationTaskBean’
at org.activiti.engine.impl.juel.AstIdentifier.eval(AstIdentifier.java:83) ~[?:?]
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) ~[?:?]
… 170 more

The blueprint.xml looks like this:

<reference id="repositoryService" interface="org.activiti.engine.RepositoryService" />
<reference id="runtimeService" interface="org.activiti.engine.RuntimeService" />
<reference id="processEngine" interface="org.activiti.engine.ProcessEngine" />

<bean id="taskBean" class="my.delegates.CalculationTaskDelegate"/>
<service ref="taskBean" interface="org.activiti.engine.delegate.JavaDelegate" />

Has anyone met such problem?

NOTE: The need behind using beans is because of the intent of injecting a service interface (exported by another bundle) into the bean.


Flowable-engine in OSGi - Tutorials/examples?
#2

Have you configured a bean of type BlueprintELResolver in ProcessEngineFactoryWithELResolver? you also need a blueprint reference-list and reference-listener. If yes, your example should work.

The blueprint should look like (not tested):

<bean id="blueprintELResolver" class="org.activiti.osgi.blueprint.BlueprintELResolver" />

<reference-list interface="org.activiti.engine.delegate.JavaDelegate" availability="optional">
	<reference-listener bind-method="bindService" unbind-method="unbindService">
		<ref component-id="blueprintELResolver" />
	</reference-listener>
</reference-list>


<bean id="processEngineFactory" class="org.activiti.osgi.blueprint.ProcessEngineFactoryWithELResolver" init-method="init" destroy-method="destroy">
	<property name="processEngineConfiguration" ref="processEngineConfiguration" />
	<property name="bundle" ref="blueprintBundle" />
	<property name="blueprintELResolver" ref="blueprintELResolver" />
</bean>

Flowable provides 2 ways of resolving beans from blueprints:

  1. BlueprintELResolver: resolves beans exposed as osgi service from other bundles --> implementing JavaDelegate is required, no other methods on that bean can be called by EL
  2. BlueprintContextELResolver: resolves beans from the blueprint container within the same bundle --> no beans from other bundles can be resolved

Because of the handicaps I mentioned above, we have our own BlueprintELResolver, which can resolve beans from other bundles/blueprint-container, so that an EL like

activiti:expression="${myBean.myMethod()}"

is possible in your bpmn service-task. You find an example here:


#3

From what I read from your post, I was missing the <reference-list> part in my process-engine bundle blueprint.

Now, the error is another:

org.activiti.engine.impl.interceptor.CommandContext - Error while closing command context
org.activiti.engine.ActivitiIllegalArgumentException: Field definition uses unexisting field ‘taskConfiguration’ on class com.sun.proxy.$Proxy21
at org.activiti.engine.impl.bpmn.helper.ClassDelegate.applyFieldDeclaration(ClassDelegate.java:279) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.bpmn.helper.ClassDelegate.applyFieldDeclaration(ClassDelegate.java:252) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.bpmn.helper.DelegateExpressionUtil.resolveDelegateExpression(DelegateExpressionUtil.java:43) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.bpmn.behavior.ServiceTaskDelegateExpressionActivityBehavior.execute(ServiceTaskDelegateExpressionActivityBehavior.java:90) ~[flowable-engine-5.23.0.jar:5.23.0]
at org.activiti.engine.impl.pvm.runtime.AtomicOperationActivityExecute.execute(AtomicOperationActivityExecute.java:60) ~[flowable-engine-5.23.0.jar:5.23.0]

That is because I am using:

<serviceTask id="taskBean1" name="taskBean1" activiti:delegateExpression="#{taskBean}" >
	<extensionElements>
		<activiti:field name="taskConfiguration">
			<activiti:string> {
				"property1":"something",
				"property2":"something else"
			}</activiti:string>
		</activiti:field>
	</extensionElements>
</serviceTask>

So, I must be now in the case described under: https://community.alfresco.com/thread/217001-servicetask-delegateexprssion-is-not-honoring-field-settings


#4

Flowable field injection (activiti:field) will not work, because you reference an existing bean (already instantiated object), which is controlled by blueprint (not by flowable), so you have to inject the taskConfiguration in blueprint - not in bpmn


#5

I see… That is not a good news as, for my prototype, the taskBean shall be used in multiple serviceTask's of this type repeated in a same process, each with different settings.

Note: One component of my prototype is about legacy system based on jBPM 3.x/jPDL to be migrated to BPMN on Flowable.

I will need to do further digging on the matter…


#6

either instantiate multiple beans of type taskBean in blueprint (each which its own configuration) or pass the desired configuration as an argument using activiti:expression


#7

I got looking at the Flowable Docs in regard to what you proposed, and I have discovered the following in regard to “Field injection and thread safety”:

When using the flowable:delegateExpression attribute, the thread-safety of the delegate instance will depend on how the expression is resolved. If the delegate expression is reused in various tasks or process definitions, and the expression always returns the same instance, using field injection is not thread-safe .
[…]
If the expression resolves to the same instance, there can be race conditions in concurrent scenarios when it comes to injecting the field someField when the processes are executed.

The easiest solution to solve this is to either:

  • rewrite the Java delegate to use an expression and passing the required data to the delegate via a method arguments.
  • return a new instance of the delegate class each time the delegate expression is resolved. For example, when using Spring, this means that the scope of the bean must be set to prototype (such as by adding the @Scope(SCOPE_PROTOTYPE) annotation to the delegate class).

As of Flowable v5.22, the process engine configuration can be set in a way to disable the use of field injection on delegate expressions, by setting the value of the delegateExpressionFieldInjectionMode property (which takes one of the values in the org.flowable.engine.imp.cfg.DelegateExpressionFieldInjectionMode enum).

Following settings are possible:

  • DISABLED : fully disables field injection when using delegate expressions. No field injection will be attempted. This is the safest mode when it comes to thread-safety.
  • COMPATIBILITY : in this mode, the behavior will be exactly as it was before v5.21: field injection is possible when using delegate expressions and an exception will be thrown when the fields are not defined on the delegate class. This is, of course, the least safe mode with regards to thread-safety, but it can be necessary for backwards compatibility or can be used safely when the delegate expression is used only on one task in a set of process definitions (and thus no concurrent race conditions can happen).
  • MIXED : Allows injection when using delegateExpressions, but will not throw an exception when the fields are not defined on the delegate. This allows for mixed behaviors, where some delegates have injection (for example, because they are not singletons) and some don’t.
  • The default mode for Flowable version 5.x is COMPATIBILITY.
  • The default mode for Flowable version 6.x is MIXED.

This sounds very promising.


#8

I had a go using scope="prototype" in the bean and delegateExpressionFieldInjectionMode=MIXED set for the Process Engine Configuration.
The org.activiti.engine.ActivitiIllegalArgumentException: Field definition uses unexisting field ‘taskConfiguration’ on class com.sun.proxy.$Proxy21 error does not occur anymore.

Unfortunately, the taskConfiguration expression field in the delegate bean is not set (i.e. NULL).
I have debugged the resolving of the expression to discovered that there is a problem in the ReflectUtil for the following methods"

  • getField(String fieldName, Class<?> clazz)
  • getSetter(String fieldName, Class<?> clazz, Class<?> fieldType)

In both case, Class<?> clazz is the Proxy (e.g. com.sun.proxy.$Proxy21) of delegate bean class and not the delegate bean class, hence it is trying to find the field/setter of the Expression on the Proxy class.


#9

I solved the Proxy related issue by creating an interface extending org.activiti.engine.delegate.JavaDelegate and with a setter for taskConfiguration.

public interface TaskDelegateInterface extends JavaDelegate {
void setTaskConfiguration(final Expression configuration);
}

and exporting that interface as service in my blueprint:

<bean id=“taskBean” class=“my.delegates.CalculationTaskDelegate”/>
<service ref=“taskBean” interface=“my.delegates.TaskDelegateInterface” />

As well as a <reference-list> and <reference-listener> on that interface against the blueprintELResolver.