I run flowable-task by using flowable/all-in-one:6.4.1 docker image. I published a new process which contains many service tasks in it, and put my JAR under webapps/flowable-task/WEB-INF/lib. It works very well when running.
However, if I did the following steps …
- Move my JAR out of webapps/flowable-task/WEB-INF/lib
- Restart flowable/all-in-one container
- Put my JAR into webapps/flowable-task/WEB-INF/lib back
- Use API “/flowable-task/process-api/runtime/process-instances” to init my process instance
At the last step, it will report “couldn’t instantiate class xxx.xxx.xxx” due to “Class not found”. The only way to solve this is to restart flowable/all-in-one container again.
I think I should publish any new process and JAR when Flowable is running, and the new process and JAR can work without restart Flowable, right?
Why need I restart Flowable in this case?
By default the JVM will scan the classpath on start up. There is probably something we could do to have the classloader rescan, but you’re better off just adding the jar to the libs folder and restarting.
Thanks for your reply. This means I need restart it after deploying any new process, right? But in Flowable document, it says “During deployment of a business archive however, those classes don’t have to be present on the classpath. This means that your delegation classes don’t have to be on the classpath when deploying a new business archive with Ant, for example.”. (https://www.flowable.org/docs/userguide/index.html#_java_classes)
If Flowable cannot rescan and find out new JARs in this case, the feature of runtime process deployment is useless. The deployed process may contain some JARs, these JARs will not be present until the new process is deployed.
You’d only need to restart if the process has a service task that utilizes a new class. You can describe some fairly complex processes using only the built in tasks. You might also deploy an updated version of the process that uses the existing delegates.
All custom classes that are used in your process (for example, JavaDelegates used in Service Tasks or event-listeners, TaskListeners and so on) should be present on the engine’s classpath when an instance of the process is started.
They need to be on the classpath when a process is actually started, but the flowable engine is not going to check the classpath for them when they are deployed. I take that to mean that you can deploy the process before you add the jar and restart. It’s your choice which order you do it in.
Thanks. At least, I know restart is required if any new JAR is added.