Workflow with decision table is not working (NullPointerException)

Hi,

I tried to use decision tables in my simple workflow, but I faced some issues. I created a basic workflow with a decision task, which is linked to a decision table.
When I validate the model it returns with the message “No decision table reference key is defined…”, but as I read it on this forum, that’s fine.

Then I deployed the workflow, it went OK.
But when I tried to use it, I got a NullPointerException.
The relevant stacktrace can be found below.

Since I don’t initiate the workflow via the official Flowable API, but through a custom Spring application I wrote, I might have configured something incorrectly.
The application is deployed to a tomcat, v9.0.2, it uses Spring boot 2.0.3.RELEASE
The Flowable dependency is imported like that (so all the libraries should be on the classpath):

<dependency>
    <groupId>org.flowable</groupId>
    <artifactId>flowable-spring-boot-starter</artifactId>
    <version>6.3.1</version>
</dependency>

As you can see below the exception is thrown in line DmnActivityBehavior.java:99, where the ruleService is null. That’s because the CommandContextUtil.java:267 returns with null, which is this line:

return (DmnEngineConfigurationApi) commandContext.getEngineConfigurations().get(EngineConfigurationConstants.KEY_DMN_ENGINE_CONFIG);

The commandContext.getEngineConfigurations() has only 3 configurations:

0 = {HashMap$Node@20712} "cfg.formEngine" -> 
1 = {HashMap$Node@20713} "cfg.processEngine" -> 
2 = {HashMap$Node@20714} "cfg.idmEngine" -> 

For some reason the cfg.dmnEngine is not there.

Does anybody know what am I doing wrong?

Edit: If I take out the decision table, then the process initiation works just fine.

The exception:

java.lang.NullPointerException: null
	at org.flowable.engine.impl.bpmn.behavior.DmnActivityBehavior.execute(DmnActivityBehavior.java:99) ~[flowable-engine-6.3.1.jar:6.3.1]
	at org.flowable.engine.impl.agenda.ContinueProcessOperation.executeActivityBehavior(ContinueProcessOperation.java:258) ~[flowable-engine-6.3.1.jar:6.3.1]
	at org.flowable.engine.impl.agenda.ContinueProcessOperation.executeSynchronous(ContinueProcessOperation.java:155) ~[flowable-engine-6.3.1.jar:6.3.1]
	at org.flowable.engine.impl.agenda.ContinueProcessOperation.continueThroughFlowNode(ContinueProcessOperation.java:112) ~[flowable-engine-6.3.1.jar:6.3.1]
	at org.flowable.engine.impl.agenda.ContinueProcessOperation.continueThroughSequenceFlow(ContinueProcessOperation.java:305) ~[flowable-engine-6.3.1.jar:6.3.1]
	at org.flowable.engine.impl.agenda.ContinueProcessOperation.run(ContinueProcessOperation.java:78) ~[flowable-engine-6.3.1.jar:6.3.1]
	at org.flowable.engine.impl.interceptor.CommandInvoker.executeOperation(CommandInvoker.java:88) ~[flowable-engine-6.3.1.jar:6.3.1]
	at org.flowable.engine.impl.interceptor.CommandInvoker.executeOperations(CommandInvoker.java:72) ~[flowable-engine-6.3.1.jar:6.3.1]
	at org.flowable.engine.impl.interceptor.CommandInvoker.execute(CommandInvoker.java:56) ~[flowable-engine-6.3.1.jar:6.3.1]
	at org.flowable.engine.impl.interceptor.BpmnOverrideContextInterceptor.execute(BpmnOverrideContextInterceptor.java:25) ~[flowable-engine-6.3.1.jar:6.3.1]
	at org.flowable.common.engine.impl.interceptor.TransactionContextInterceptor.execute(TransactionContextInterceptor.java:53) ~[flowable-engine-common-6.3.1.jar:6.3.1]
	at org.flowable.common.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:71) ~[flowable-engine-common-6.3.1.jar:6.3.1]
	at org.flowable.idm.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:49) ~[flowable-idm-spring-6.3.1.jar:6.3.1]
	at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140) ~[spring-tx-5.0.7.RELEASE.jar:5.0.7.RELEASE]
	at org.flowable.idm.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:46) ~[flowable-idm-spring-6.3.1.jar:6.3.1]
	at org.flowable.common.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:30) ~[flowable-engine-common-6.3.1.jar:6.3.1]
	at org.flowable.common.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:56) ~[flowable-engine-common-6.3.1.jar:6.3.1]
	at org.flowable.common.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:51) ~[flowable-engine-common-6.3.1.jar:6.3.1]
	at org.flowable.engine.impl.TaskServiceImpl.complete(TaskServiceImpl.java:208) ~[flowable-engine-6.3.1.jar:6.3.1]

Hi,

Is there perhaps some DMN engine related logging when booting the app?
Because add the starter should result with the engines configured (and aware of each other).

Regards,

Yvo

Hi @yvo,

There was some logging output of dmn, like below:

2018-08-14 09:27:17.893  INFO 15328 --- [ost-startStop-1] o.f.app.engine.AppEngineConfiguration    : Found 6 Engine Configurators in total:
2018-08-14 09:27:17.895  INFO 15328 --- [ost-startStop-1] o.f.app.engine.AppEngineConfiguration    : class org.flowable.engine.spring.configurator.SpringProcessEngineConfigurator (priority:50000)
2018-08-14 09:27:17.896  INFO 15328 --- [ost-startStop-1] o.f.app.engine.AppEngineConfiguration    : class org.flowable.idm.spring.configurator.SpringIdmEngineConfigurator (priority:100000)
2018-08-14 09:27:17.896  INFO 15328 --- [ost-startStop-1] o.f.app.engine.AppEngineConfiguration    : class org.flowable.dmn.spring.configurator.SpringDmnEngineConfigurator (priority:200000)
2018-08-14 09:27:17.897  INFO 15328 --- [ost-startStop-1] o.f.app.engine.AppEngineConfiguration    : class org.flowable.form.spring.configurator.SpringFormEngineConfigurator (priority:300000)
2018-08-14 09:27:17.897  INFO 15328 --- [ost-startStop-1] o.f.app.engine.AppEngineConfiguration    : class org.flowable.content.spring.configurator.SpringContentEngineConfigurator (priority:400000)
2018-08-14 09:27:17.898  INFO 15328 --- [ost-startStop-1] o.f.app.engine.AppEngineConfiguration    : class org.flowable.cmmn.spring.configurator.SpringCmmnEngineConfigurator (priority:500000)
2018-08-14 09:27:17.898  INFO 15328 --- [ost-startStop-1] o.f.app.engine.AppEngineConfiguration    : Executing beforeInit() of class org.flowable.engine.spring.configurator.SpringProcessEngineConfigurator (priority:50000)
2018-08-14 09:27:17.930  INFO 15328 --- [ost-startStop-1] o.f.app.engine.AppEngineConfiguration    : Executing beforeInit() of class org.flowable.idm.spring.configurator.SpringIdmEngineConfigurator (priority:100000)
2018-08-14 09:27:17.937  INFO 15328 --- [ost-startStop-1] o.f.app.engine.AppEngineConfiguration    : Executing beforeInit() of class org.flowable.dmn.spring.configurator.SpringDmnEngineConfigurator (priority:200000)
2018-08-14 09:27:17.944  INFO 15328 --- [ost-startStop-1] o.f.app.engine.AppEngineConfiguration    : Executing beforeInit() of class org.flowable.form.spring.configurator.SpringFormEngineConfigurator (priority:300000)
2018-08-14 09:27:17.952  INFO 15328 --- [ost-startStop-1] o.f.app.engine.AppEngineConfiguration    : Executing beforeInit() of class org.flowable.content.spring.configurator.SpringContentEngineConfigurator (priority:400000)
2018-08-14 09:27:17.958  INFO 15328 --- [ost-startStop-1] o.f.app.engine.AppEngineConfiguration    : Executing beforeInit() of class org.flowable.cmmn.spring.configurator.SpringCmmnEngineConfigurator (priority:500000)
2018-08-14 09:27:22.813  INFO 15328 --- [ost-startStop-1] o.f.app.engine.AppEngineConfiguration    : Executing configure() of class org.flowable.engine.spring.configurator.SpringProcessEngineConfigurator (priority:50000)

But looks like the issue was that in my config when I create the ProcessEngineConfigurationImpl bean, I haven’t added the SpringDmnEngineConfigurator to the SpringProcessEngineConfiguration (pretty new to Flowable).

So this is how the bean should be initialized (in my case at least):

@Bean
public ProcessEngineFactoryBean processEngineFactoryBean() {
    SpringProcessEngineConfiguration config = new SpringProcessEngineConfiguration();
    config.setDataSource(dataSource);
    config.setTransactionManager(transactionManager());
    config.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE);
    config.setAsyncExecutorActivate(false);

    // Have to add the different configurators that will be used in the workflow
    //config.addConfigurator(new FormEngineConfigurator()); // We don't use formEngine, so it's commented out
    config.addConfigurator(new SpringDmnEngineConfigurator()); //<-- This was missing

    ProcessEngineFactoryBean factoryBean = new ProcessEngineFactoryBean();
    factoryBean.setProcessEngineConfiguration(config);
    return factoryBean;
}

My question would be, how is that the other engines (processEngine and idmEngine) are added to the configurations by default, but not the dmnEngine?

The answer could be that both those engines are a core part of Flowable, so they’re always initialized, but that’s just a guess.

Thanks

Hi,

The process engine is there because that’s engine that is created with the SpringProcessEngineConfiguration. The IDM engine is by default there as part of the process engine. You can however disable the IDM engine by using setDisableIdmEngine(true) on the process engine configuration. The other engines like the DMN and CMMN engine are only there if you use the configurator. With the Spring Boot auto configure module this is done automatically, so you only have to make sure the engines JARs are on the classpath.

Best regards,

Tijs