Recently, I’ve changed the classpath of my Spring boot application using embedded Flowable engine version 7.0.0.M1
For example, older class path was “com.a.b.c.GetItemsWorker” (GetItemsWorker is my class)
New class path is “com.x.y.z.GetItemsWorker”
When I try to run the existing Workflow which was created before changing the class path then I get below error,
org.flowable.common.engine.api.FlowableException: couldn’t instantiate class com.a.b.c.GetItemsWorker
at org.flowable.common.engine.impl.util.ReflectUtil.instantiate(ReflectUtil.java:139)
at org.flowable.engine.impl.bpmn.helper.AbstractClassDelegate.defaultInstantiateDelegate(AbstractClassDelegate.java:64)
at org.flowable.engine.impl.bpmn.helper.AbstractClassDelegate.defaultInstantiateDelegate(AbstractClassDelegate.java:75)
at org.flowable.engine.impl.bpmn.helper.AbstractClassDelegate.instantiateDelegate(AbstractClassDelegate.java:49)
at org.flowable.engine.impl.bpmn.helper.ClassDelegate.getActivityBehaviorInstance(ClassDelegate.java:257)
at org.flowable.engine.impl.bpmn.helper.ClassDelegate.execute(ClassDelegate.java:190)
at org.flowable.engine.impl.agenda.ContinueProcessOperation.executeActivityBehavior(ContinueProcessOperation.java:298)
at org.flowable.engine.impl.agenda.ContinueProcessOperation.executeSynchronous(ContinueProcessOperation.java:175)
at org.flowable.engine.impl.agenda.ContinueProcessOperation.continueThroughFlowNode(ContinueProcessOperation.java:125)
at org.flowable.engine.impl.agenda.ContinueProcessOperation.run(ContinueProcessOperation.java:88)
at org.flowable.common.engine.impl.AbstractEngineConfiguration.lambda$new$0(AbstractEngineConfiguration.java:195)
at org.flowable.engine.impl.interceptor.CommandInvoker.executeOperation(CommandInvoker.java:130)
at org.flowable.engine.impl.interceptor.CommandInvoker.executeOperations(CommandInvoker.java:114)
at org.flowable.engine.impl.interceptor.CommandInvoker.execute(CommandInvoker.java:72)
at org.flowable.engine.impl.interceptor.BpmnOverrideContextInterceptor.execute(BpmnOverrideContextInterceptor.java:26)
at org.flowable.common.engine.impl.interceptor.TransactionContextInterceptor.execute(TransactionContextInterceptor.java:53)
at org.flowable.common.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:105)
at org.flowable.common.spring.SpringTransactionInterceptor.lambda$execute$0(SpringTransactionInterceptor.java:57)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)
at org.flowable.common.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:57)
at org.flowable.common.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:30)
at org.flowable.common.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:56)
at org.flowable.common.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:51)
at org.flowable.job.service.impl.asyncexecutor.ExecuteAsyncRunnable.executeJob(ExecuteAsyncRunnable.java:127)
at org.flowable.job.service.impl.asyncexecutor.ExecuteAsyncRunnable.run(ExecuteAsyncRunnable.java:115)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: org.flowable.common.engine.api.FlowableClassLoadingException: Class not found: com.a.b.c.GetItemsWorker
at org.flowable.common.engine.impl.util.ReflectUtil.loadClass(ReflectUtil.java:89)
at org.flowable.common.engine.impl.util.ReflectUtil.instantiate(ReflectUtil.java:136)
... 27 common frames omitted
Caused by: java.lang.ClassNotFoundException: com.a.b.c.GetItemsWorker
at org.springframework.boot.web.embedded.tomcat.TomcatEmbeddedWebappClassLoader.loadClass(TomcatEmbeddedWebappClassLoader.java:72)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1165)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:467)
at org.flowable.common.engine.impl.util.ReflectUtil.loadClass(ReflectUtil.java:328)
at org.flowable.common.engine.impl.util.ReflectUtil.loadClass(ReflectUtil.java:70)
I’m wondering why Flowable engine is looking for older class at older class path.
Interestingly, if I update and save the existing Workflow which was causing the issue, then I Don’t get this error
Could anyone let me know what is happening?