# Flowable-engine in OSGI (Karaf)

**URL:** <https://forum.flowable.org/t/flowable-engine-in-osgi-karaf/2132>\
**Category:** Flowable Engine\
**Created:** [June 14, 2018, 9:56am UTC](https://forum.flowable.org/t/flowable-engine-in-osgi-karaf/2132 "2018-06-14T09:56:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mimi](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/mimi/32/702_2.png) [@mimi](https://forum.flowable.org/u/mimi)\
**Post date:** [June 14, 2018, 9:56am UTC](https://forum.flowable.org/t/flowable-engine-in-osgi-karaf/2132/1 "2018-06-14T09:56:14Z")

</div>

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](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](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

---

<div class="post-metadata">

**Author:** ![schmke](https://avatars.discourse-cdn.com/v4/letter/s/d78d45/32.png) [@schmke](https://forum.flowable.org/u/schmke)\
**Post date:** [June 25, 2018, 8:51pm UTC](https://forum.flowable.org/t/flowable-engine-in-osgi-karaf/2132/2 "2018-06-25T20:51:38Z")

</div>

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"/>
```

---

<div class="post-metadata">

**Author:** ![mimi](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/mimi/32/702_2.png) [@mimi](https://forum.flowable.org/u/mimi)\
**Post date:** [June 27, 2018, 3:16pm UTC](https://forum.flowable.org/t/flowable-engine-in-osgi-karaf/2132/3 "2018-06-27T15:16:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mimi](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/mimi/32/702_2.png) [@mimi](https://forum.flowable.org/u/mimi)\
**Post date:** [June 28, 2018, 3:22pm UTC](https://forum.flowable.org/t/flowable-engine-in-osgi-karaf/2132/4 "2018-06-28T15:22:18Z")

</div>

Hi,

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

Thx

---

<div class="post-metadata">

**Author:** ![Ceddaerrix](https://avatars.discourse-cdn.com/v4/letter/c/c77e96/32.png) [@Ceddaerrix](https://forum.flowable.org/u/Ceddaerrix)\
**Post date:** [December 17, 2018, 12:57pm UTC](https://forum.flowable.org/t/flowable-engine-in-osgi-karaf/2132/5 "2018-12-17T12:57:34Z")

</div>

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](https://forum.flowable.org/t/classloading-issues-running-flowable-6-4-0-on-karaf/2964/10)
