How to configure flowable-rest.war using JNDI


I’m trying to configure flowable-rest(v6) to use JNDI with Tomcat server similar to Flowable UI applications.
Unzipped flowable-rest.war, but I couldn’t find any files like ‘’ in flowable-rest app.
Which file do I have to edit?

Any help would be appreciated.


The exposed properties for the Flowable REST APP are in and in
But these don’t allow you to configure the datasource for JDNI.

The REST APP contains a flowable-custom-context.xml file.
With this you can have full control on configuring the Spring context.

Let me know if you need help with that.

Regards Yvo

Thank you for your response.

Yes, I’ve tried to edit flowable-custom-context.xml file.

First I uncommented the all comments in this file, and modified ‘dataSource’ bean tag as below.
(Of course jdbc/flowableDB is prepared in tomcat server setting)

<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
    <property name="jndiName" value="java:comp/env/jdbc/flowableDB"/>

Once I reboot tomcat server, then I could find some demo-user records (such as fozzie or kermit…) were inserted into ACT_ID_USER table of ‘jdbc/flowableDB’. So I was sure flowable has been able to lookup JNDI.

But badly I saw some errors occured, while server starting up, and flowable-rest instance was force removed by tomcat server.(maybe destroyd as soon as it added demo data to DB…)

org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘formRepositoryService’ defined in class path resource [org/flowable/rest/conf/FlowableEngineConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.flowable.form.api.FormRepositoryService]: Factory method ‘formRepositoryService’ threw exception; nested exception is java.lang.ClassCastException: org.flowable.spring.ProcessEngineFactoryBean$$EnhancerBySpringCGLIB$$d4574dac cannot be cast to org.flowable.engine.ProcessEngine
at …

I can’t understand this error message, but I think there is something wrong with ‘flowable-custom-context.xml’ file it’self.
(because of I did nothing special except modifying ‘dataSource’ bean tag as above)

Would you please let me know what’s wrong?

Hi …

You’re correct. The commented out section is not updated with the latest way to initialize the separate engines (dmn, form and content) and inject them into the process engine.

Take a look at this flowable-custom-context.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="" xmlns:xsi=""
  xmlns:context="" xmlns:tx=""
  xmlns:jee="" xmlns:aop=""
	<bean id="dbProperties" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
	    <property name="locations">
		<property name="ignoreUnresolvablePlaceholders" value="true" />
		<property name="ignoreResourceNotFound" value="true" />

	<bean id="dataSource"
		<property name="driverClass" value="${datasource.driver}" />
		<property name="url" value="${datasource.url}" />
		<property name="username" value="${datasource.username}" />
		<property name="password" value="${datasource.password}" />

	<bean id="transactionManager"
		<property name="dataSource" ref="dataSource" />
    <!-- start new -->
	<bean id="dmnEngineConfigurator" class="org.flowable.dmn.spring.configurator.SpringDmnEngineConfigurator" />
	<bean id="formEngineConfigurator" class="org.flowable.form.spring.configurator.SpringFormEngineConfigurator" />
	<bean id="contentEngineConfigurator" class="org.flowable.content.spring.configurator.SpringContentEngineConfigurator" />
    <!-- end new -->

	<bean id="processEngineConfiguration" class="org.flowable.spring.SpringProcessEngineConfiguration">
		<property name="dataSource" ref="dataSource" />
		<property name="transactionManager" ref="transactionManager" />
		<property name="databaseSchemaUpdate" value="true" />
		<property name="mailServerHost" value="localhost" />
		<property name="mailServerPort" value="5025" />

		<!-- start new -->
		<property name="configurators">
				<ref bean="dmnEngineConfigurator" />
				<ref bean="formEngineConfigurator" />
				<ref bean="contentEngineConfigurator" />
		<!-- end new -->

	<bean id="processEngine" class="org.flowable.spring.ProcessEngineFactoryBean">
		<property name="processEngineConfiguration" ref="processEngineConfiguration" />

	<bean id="repositoryService" factory-bean="processEngine" factory-method="getRepositoryService" />
    <bean id="runtimeService" factory-bean="processEngine" factory-method="getRuntimeService" />
    <bean id="taskService" factory-bean="processEngine" factory-method="getTaskService" />
    <bean id="formService" factory-bean="processEngine" factory-method="getFormService" />
    <bean id="historyService" factory-bean="processEngine" factory-method="getHistoryService" />
    <bean id="managementService" factory-bean="processEngine" factory-method="getManagementService" />
    <bean id="identityService" factory-bean="processEngine" factory-method="getIdentityService" />

	<!-- start new -->
    <bean id="formRepositoryService" factory-bean="processEngine" factory-method="getFormEngineRepositoryService" />
    <bean id="formEngineService" factory-bean="processEngine" factory-method="getFormEngineFormService" />
    <bean id="dmnRepositoryService" factory-bean="processEngine" factory-method="getDmnRepositoryService" />
    <bean id="dmnRuleService" factory-bean="processEngine" factory-method="getDmnRuleService" />
    <bean id="contentService" factory-bean="processEngine" factory-method="getContentService" />
	<!-- end new -->

Also don’t forget to remove the @Configuration annotation from the class.

Let me know if this helps.
I’ll make sure this ends up in the repo before the next release.



It works! Thank you a lot Yvo!

I made the FlowableEngineConfiguration.class disabled, put the flowable-custom-context.xml as you have shown, and modified dataSource-tag to use JNDI.

This time flowable-rest works properly with JNDI.
Thanks again!

However, when I decide to use this new flowable-custom-context.xml, always need to disable(recompile) the existing Configuration class?

Hi. Glad to hear that it worked.

Yes. Currently this is the case. When you don’t use the property files to configure the application, but use your own context configuration you have to recompile and build your war.

I’ll have a look to see if it’s feasible to have the jndi setting exposed in the property file.



Hi Yvo,

Ok, I see. Exposing JNDI setting is great, It’s so convenient for me if the functionality could be added.
Thank you in advance.


I looked at it again.
If you change the following in the posted custom-context-xml;

<bean id="formEngineFormService" factory-bean="processEngine" factory-method="getFormEngineFormService" />

You don’t need to remove the @Configuration annotation of the FlowableEngineConfiguration class.
With the id change all the beans from the Java configuration class get overwritten by the context-xml.

Hope this helps.




Thanks for the additional info.

I tried and made sure that all the beans were overridden by definitions in the context file, without removing the @Configuration annotation from the java config class.

I would do this way. Thanks again for everything.:relaxed:

Hi. The suggested config and removal @Configuration doesn’t work me (Flowable 6.2.1). I’m getting:

2018-03-11 23:59:22.817:WARN:oejw.WebAppContext:main: Failed startup of context o.e.j.w.WebAppContext@7e0b0338{/flowable-rest,file:///tmp/jetty-,UNAVAILABLE}{/var/tmp/flowable-rest.war}
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘formRepositoryService’ defined in class path resource [flowable-custom-context.xml]: No matching factory method found: factory bean ‘processEngine’; factory method ‘getFormEngineRepositoryService()’. Check that a method with the specified name exists and that it is non-static.

Any suggestions?