AnsweredAssumed Answered

Classloading problem with osgi

Question asked by lvolckaert on Jun 17, 2013
Latest reply on Jun 18, 2013 by frederikheremans1
Hi,

I'm running Activiti in an OSGI environment, with the engine in one bundle and several other bundles provide the process definitions and related resources.

I've run into a ClassNotFoundException when reading a process variable I've set previously, because the engine bundle classloader does not know the Class of the process variable.
Which is normal because it's an implementation and I don't what to export those in my OSGI environment.

So I see a few options to get the deserialization to work but I would like some guidance.

1) Create a custom VariableType for each process variable I want to store. Can I add these dynamically to the configuration depending on the bundles that are active?

2) Forget storing serializable types and convert the object to XML or JSON first and deconvert from string process variable with my own converter.

3) Replace the classloader on the ProcessEngineConfigurationImpl each time you load a process variable so the ReflectUtil will find it.

4) Temporarily replace the classloader of the thread.

5) Other ?

I would preferably not use 3 or 4 because they seem to be cheating OSGI.

So what's the best way? Any tips or tricks?

Outcomes