RuntimeService returns null in JavaDelegate


Want to set the businessKey dynamically via JavaDelagate in service task. Delegate Java class is deployed as jar inside flowable-task.war. But when executing null pointer exception is thrown at this statement -> runtimeService.updateBusinessKey

Flowable ver :

private RuntimeService runtimeService;

Hey @suds,

Are you by any chance using flowable:class in your service task?

Have a look at this section of the documentation for more information about the different attributes that you can use for the service task.

The most important is that when you are using flowable:class then you can’t use Spring Autowiring in those classes, because Flowable will initialise them and not Spring.

If you want to use autowiring then you will have to make your JavaDelegate a Spring Component and use flowable:delegateExpression.


Thanks @filiphr.

Was indeed using java class, but yes in this scenario , bean creation required via delegateExpression