AnsweredAssumed Answered

Integrating Activiti into OSGi Environment

Question asked by timo.rohrberg on Jul 11, 2016
Latest reply on Jul 18, 2016 by trademak
Hello everybody,

we are using Activiti within an Eclipse Equinox OSGi environment. We do so by consuming the activiti-engine bundle downloaded from Maven Central within one of our bundles. In that bundle, we then create a ProcessEngineConfiguration like this in the bundle's Activator:

final ProcessEngineConfiguration configuration = ProcessEngineConfiguration
    .createProcessEngineConfigurationFromInputStream( new FileInputStream( "activiti.cfg.xml" ), "WorkflowEngineConfiguration" );

However, this does not work since the activiti framework uses Spring Beans to load the configuration from the provided activiti.cfg.xml configuration file. We managed to get the file loaded by the Spring Beans framework, but when it tries to resolve the org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration class, it fails with a classloading problem as it delegates the classloading to the org.eclipse.osgi.internal.framework.ContextFinder implementation of a classloader. That further delegates the actual classloading to the classloader instance of the Spring Beans bundle which of course does not see the stated StandaloneProcessEngineConfiguration class of the activiti-engine bundle. We would have to declare a dependency from the Spring Beans bundle to the activit-engine bundle which is of course not desired.

To me the problem seems to be the general problem of integrating spring beans into OSGi which is almost impossible since the Spring framework dropped OSGi-support. I think Activiti could provide an additional way of loading its configuration from a file without relying on Spring Beans. That would make it much simpler to integrate Activiti into an OSGi context.

Do you guys have any hints how to integrate Activiti into an OSGi-based application?

We appreciate any comment, hint, suggestion, …

Best regards
Timo Rohrberg