How can I use my own classloaders instead of the default one within the ProcessEngine ?

cancel
Showing results for 
Search instead for 
Did you mean: 
louisp
Member II

How can I use my own classloaders instead of the default one within the ProcessEngine ?

I am trying to add support for Groovy Objects in my project.

In a Groovy script of mine, I am facing a GroovyCastException.

Script1.groovy

Foo f = new Foo() // <--- Foo is a Groovy class of mine

execution.setVariable('foo', f);

Up to here, it works fine, but later on, in another script I try to assign this value.

Script2.groovy

Foo f = foo // <-- Assigning the in-memory variable 'foo' to my new variable 'f'

The GroovyCastException happens here. This is because in Script1, I call VariableScope#setVariable() which loads the class with Activiti classloader, but in Script2 it is a custom classloader of mine that loads the class.

Hence my question, is it possible to override Activiti classloader with my own classloader ? If yes, which guidelines should I follow ?

Thanks

Louis

1 Reply
louisp
Member II

Re: How can I use my own classloaders instead of the default one within the ProcessEngine ?

Also, I have one constraint which is that I have different kinds of classloaders that are resolved at runtime. So I can't just rely on that static SpringProcessEngineConfiguration.