Flowable-engine in OSGI (Karaf)

Target Karaf (4 or 3)
I try to integrate a code writent in pur java, inside a bundle (runing inside karaf)
But unfortunately, when I run this code:
ProcessEngineConfiguration configuration = ProcessEngineConfiguration.createStandaloneInMemProcessEngineConfiguration();
this.processEngine = configuration.buildProcessEngine();

I have the following error:
java.lang.IllegalArgumentException: InputStream cannot be null …

When I run this:
this.processEngine
= ProcessEngineConfiguration
.createStandaloneProcessEngineConfiguration()
.createProcessEngineConfigurationFromInputStream(configInputStream)
.setAsyncExecutorActivate(true)
.setJdbcUrl(“jdbc:h2:mem:eaton;DB_CLOSE_DELAY=-1”)
.setJdbcDriver(“org.h2.Driver”)
.setJdbcUsername(“sa”)
.setJdbcPassword("")
.setDatabaseSchemaUpdate(“true”)
.buildProcessEngine();
I have the following error:

org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document ‘http://www.springframework.org/schema/beans/spring-beans-2.0.xsd’, because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not xsd:schema.

I follow this article:
https://www.flowable.org/docs/userguide/index.html#_configuration

Thnaks a lot for any help.

Regards

Hi all,

I progress on this issue, but not the solution, The problem is:

Inside the AbstractEngineConfigurator class instanciate by IdmEngineConfigurator, the method registerCustomMybatisMappings coud no retrieve the resource: org/flowable/idm/db/mapping/mappings.xml

and throw an exception InputStream can not be null!

I try to set the classLoader but unfortunately , it’s does not work too!!!
Any help on this issue will be appreciate.

Regards

I use Flowable in Karaf 4 (used it in 3 too) and instantiate the engine with the following in a blueprint.xml file just fine. Doing the equivalent in code should work too.

<reference id="dataSource" interface="javax.sql.DataSource" filter="(osgi.jndi.service.name=jdbc/WorkflowDataSource)"/>

<reference id="transactionManager" interface="javax.transaction.TransactionManager"/>

<bean id="configuration" class="org.activiti.engine.impl.cfg.JtaProcessEngineConfiguration" ext:field-injection="true">
    <property name="dataSource" ref="dataSource"/>
    <property name="transactionManager" ref="transactionManager"/>
    <property name="databaseSchemaUpdate" value="true"/>
    <property name="databaseSchema" value="${databaseSchema}"/>
    <property name="jobExecutorActivate" value="false" />
    <property name="asyncExecutorEnabled" value="true" />
    <property name="asyncExecutorActivate" value="true" />
    <property name="asyncExecutorDefaultTimerJobAcquireWaitTime" value="${asyncExecutorDefaultTimerJobAcquireWaitTime}"/>
    <property name="asyncExecutorDefaultAsyncJobAcquireWaitTime" value="${asyncExecutorDefaultAsyncJobAcquireWaitTime}"/>
    <!-- configure below section to be able to use email steps -->
    <property name="useTLS" value="${mailUseTLS}" />
    <property name="mailServerHost" value="${mailServerHost}" />
    <property name="mailServerPort" value="${mailServerPort}" />
    <property name="mailServerUsername" value="${mailServerUsername}" />
    <property name="mailServerPassword" value="${mailServerPassword}"/>
</bean>

<bean id="processEngineFactory" class="org.activiti.osgi.blueprint.ProcessEngineFactoryWithELResolver" init-method="init" destroy-method="destroy">
    <property name="processEngineConfiguration" ref="configuration"/>
    <property name="bundle" ref="blueprintBundle"/>
    <property name="blueprintELResolver" ref="blueprintELResolver"/>
</bean>

<bean id="blueprintELResolver" class="com.nextgate.activiti.osgi.ServiceRegistryELResolver">
    <argument ref="blueprintBundleContext"/>
</bean>

<bean id="processEngine" factory-ref="processEngineFactory" factory-method="getObject"/>

Hi,

Thx for your comment added few days ago.
I work again on this topic, but unfortunately, it’s does not work.
I have already the same issue.
org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to initialize bean processEngineFactory



Caused by: java.lang.IllegalArgumentException: InputStream cannot be null

I foud the root cause but without any change in the code, I don’t know how to solve this issue!!
The root cause is
The AbstractEngineConfigurator does not find the resource name “org/flowable/idm/db/mapping/mappings.xml”.

this configuration file is located in the Flowable IDM engine.
So ??

I instantiate flowable engine, etc, with the following blueprint file:

<property name="processEngineConfiguration" ref="configuration" />
<property name="bundle" ref="blueprintBundle" />
<property name="blueprintELResolver" ref="blueprintELResolver" />

I don’t know how to solve my issue.

Any help will be appreciate.

Thx

Hi,

Can you give me piece of code of your class: com.nextgate.activiti.osgi.ServiceRegistryELResolver please??

Thx

I am meeting the same issue using Felix Framework. The problem comes from the Class Loading as the current bundle class loader is used while referring to a resource path from another bundle.

Probably the same issue as under: Classloading issues running flowable 6.4.0 on Karaf