cancel
Showing results for 
Search instead for 
Did you mean: 

Custom ClassLoader and Groovy Scripts

zoikks1
Champ in-the-making
Champ in-the-making
I have created a workflow framework that utilizes Activiti 5.16.3 as the workflow engine.  The framework runs in WebLogic 12c and is an EJB environment with Spring injections.  Recently, I created a specialized classloader that I use to split workflow delegates/objects outside of the framework classloader.  I have the custom classloader working except for one thing…

The workflow I'm using has a script node in it that uses Groovy as its scripting engine.  The script generates a new instance of an object that is included in the custom classloader not in the base classloader for the workflow.  I know that classloaders have access to their parent classloaders and that parent classloaders are unaware of classloaders derived from them.  As such, is there a way to change the Groovy classloader to pick up the custom classloader as well?  Initially, I would think that if we use setClassLoader() on the ProcessEngineConfiguration, it would change the classloader for everthing.

Any insights around this would be helpful.

Thanks,

Joe
3 REPLIES 3

jbarrez
Star Contributor
Star Contributor
>  I would think that if we use setClassLoader() on the ProcessEngineConfiguration, it would change the classloader for everthing.

Afaik, that doesn't propagate to the scripting engine … as that is done by the JDK itself. I'm actually not sure if that will work anyway.

Can't you get the classloader  in the script itself? The processEngineConfiguration should be reachable, even in a script (or make a reusable utility class for it …)

zoikks1
Champ in-the-making
Champ in-the-making
Thanks for the reply.

If retrieving the ProcessEngineConfiguration from the workflow is possible, what would be the syntax to retrieve it in the script node?  With that question asked, what would one do to modify the runtime classloader for Groovy?

Thanks,

- Joe

jbarrez
Star Contributor
Star Contributor
the syntax is the same as in a JavaDelegate: execution.getEngineServices().getProcessEngineConfiguration

> what would one do to modify the runtime classloader for Groovy?

I don't know about that …