Cannot get runtimeService after upgrade 6.2.1 to 6.6

Hi,
We have upgraded our software, which uses flowable engine 6.2.1, to flowable engine 6.6.
Also we implemented some custom service tasks(to send job to long running image processors) and some scheduled threads that are deployed under flowable-task newly flowable-ui.
We need runtimeService for background scheduled thread to check/manage workflows/process instanceses.
To get the runtimeService we defined a class that implements Spring’s ApplicationContextAware and we get the runtime service while loading flowable-task/ui like below:

runtimeService = (RuntimeService) applicationContext.getBean(“runtimeService”);

This was returned a bean when the version was 6.2.1 but now in v6.6 we cannot get the runtime service (it returns null).

How can we get the runtime service while the application(flowable-ui) loading?

Thank you.

All Flowable apps are the same as before, just bundled together in one distributable, so the same should be achievable.
Can you share how you register our custom ApplicationContextAware class?

Thanks joram, sorry for late reply. I didn’t notice your answer. I saw it by chance while searching another problem in forum:).

Actually, we defined a class like below and package it in a jar that is used for our custom service tasks.

package org.flowable.app.conf;

@Component
public class ExecutorCoreUpdater implements ApplicationContextAware {
private static RuntimeService runtimeService = null;

@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
   runtimeService =  (RuntimeService) applicationContext.getBean("runtimeService");

Best regards,
Burcu

Then it most likely means the logic is executed to fast. Can you store the applicationContext and retrieve the RuntimeService when needed (when the actual logic is running)?

Alternatively: have you tried getting the processEngine bean and getting the RuntimeService?

Additionally - it’s better to use the Class method getBean instead of the string.