Classloading problem with osgi

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2013 08:26 AM
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?
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?
Labels:
- Labels:
-
Archive
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2013 04:03 AM
Solutions one and two seem to be a good solution. I can't think of any other solutions…
