Spring Boot flowable app - error starting dmnEngine

Hi guys,

I am new to Flowable. My spring boot flowable app works fine for the bpmn process but once I add the dmn file in resources/dmn folder I am getting the below error on starting the application.

2021-09-15 13:16:03.374 ERROR 13284 — [ main] o.s.boot.SpringApplication : Application run failed

org.springframework.context.ApplicationContextException: Failed to start bean ‘dmnEngineConfiguration’; nested exception is org.flowable.dmn.xml.exception.DmnXMLException: javax.xml.transform.TransformerException: javax.xml.stream.XMLStreamException: org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 4; cvc-elt.1.a: Cannot find the declaration of element ‘definitions’.

is there any additional configuration needed to process DMN file? I am referring this decision table from bpmn process which is already copied in resources/processes folder.

Hi,

Can you share the DMN file?

Yvo

Hi Yvo. Thanks for the quick reply.

<definitions xmlns="https://www.omg.org/spec/DMN/20191111/MODEL/" xmlns:dmndi="https://www.omg.org/spec/DMN/20191111/DMNDI/" xmlns:dc="http://www.omg.org/spec/DMN/20180521/DC/" xmlns:di="http://www.omg.org/spec/DMN/20180521/DI/" id="definition_evaluateGroup" name="Evaluate Group" namespace="http://www.flowable.org/dmn">
  <decision id="evaluateGroup" name="Evaluate Group">
    <decisionTable id="decisionTable_20dcdcaf-7e71-43f0-93db-6e13eb272304" hitPolicy="FIRST">
      <input label="Country">
        <inputExpression id="inputExpression_61bffb8f-a6ff-4356-89f1-f29a8fc7ef8b" typeRef="string">
          <text>country</text>
        </inputExpression>
      </input>
      <input label="Report Type">
        <inputExpression id="inputExpression_412a5b93-fd32-4486-9961-6052b89137ca" typeRef="string">
          <text>reporttype</text>
        </inputExpression>
      </input>
      <input label="Product">
        <inputExpression id="inputExpression_1b63f98e-6ce5-4260-ba81-39128c31b42b" typeRef="string">
          <text>product</text>
        </inputExpression>
      </input>
      <input label="Therapeutic Area">
        <inputExpression id="inputExpression_ada91210-03da-4821-8203-31597a2bfad6" typeRef="string">
          <text>therapeuticArea</text>
        </inputExpression>
      </input>
      <input label="Seriousness">
        <inputExpression id="inputExpression_c8806837-36a1-46a4-9a6f-810cde512a83" typeRef="string"></inputExpression>
      </input>
      <input label="Received From">
        <inputExpression id="inputExpression_b2cafff3-2147-4be7-b5e7-9cbd8a5dfd47" typeRef="string"></inputExpression>
      </input>
      <input label="For Submission To">
        <inputExpression id="inputExpression_54b2b691-2de5-4a2a-a63b-4ebc82731a90" typeRef="string">
          <text>forSubmissionTo</text>
        </inputExpression>
      </input>
      <output id="outputExpression_de383d7f-32e3-44e2-9c50-d5611a2ab588" label="Group" name="group" typeRef="string"></output>
      <rule>
        <inputEntry id="inputEntry_61bffb8f-a6ff-4356-89f1-f29a8fc7ef8b_1">
          <text><![CDATA[== "India"]]></text>
        </inputEntry>
        <inputEntry id="inputEntry_412a5b93-fd32-4486-9961-6052b89137ca_1">
          <text><![CDATA[== "B"]]></text>
        </inputEntry>
        <inputEntry id="inputEntry_1b63f98e-6ce5-4260-ba81-39128c31b42b_1">
          <text><![CDATA[== "X"]]></text>
        </inputEntry>
        <inputEntry id="inputEntry_ada91210-03da-4821-8203-31597a2bfad6_1">
          <text><![CDATA[== "z"]]></text>
        </inputEntry>
        <inputEntry id="inputEntry_c8806837-36a1-46a4-9a6f-810cde512a83_1">
          <text><![CDATA[== "S"]]></text>
        </inputEntry>
        <inputEntry id="inputEntry_b2cafff3-2147-4be7-b5e7-9cbd8a5dfd47_1">
          <text><![CDATA[== "D"]]></text>
        </inputEntry>
        <inputEntry id="inputEntry_54b2b691-2de5-4a2a-a63b-4ebc82731a90_1">
          <text><![CDATA[-]]></text>
        </inputEntry>
        <outputEntry id="outputEntry_de383d7f-32e3-44e2-9c50-d5611a2ab588_1">
          <text><![CDATA["B"]]></text>
        </outputEntry>
      </rule>
      <rule>
        <inputEntry id="inputEntry_61bffb8f-a6ff-4356-89f1-f29a8fc7ef8b_2">
          <text><![CDATA[-]]></text>
        </inputEntry>
        <inputEntry id="inputEntry_412a5b93-fd32-4486-9961-6052b89137ca_2">
          <text><![CDATA[-]]></text>
        </inputEntry>
        <inputEntry id="inputEntry_1b63f98e-6ce5-4260-ba81-39128c31b42b_2">
          <text><![CDATA[-]]></text>
        </inputEntry>
        <inputEntry id="inputEntry_ada91210-03da-4821-8203-31597a2bfad6_2">
          <text><![CDATA[-]]></text>
        </inputEntry>
        <inputEntry id="inputEntry_c8806837-36a1-46a4-9a6f-810cde512a83_2">
          <text><![CDATA[-]]></text>
        </inputEntry>
        <inputEntry id="inputEntry_b2cafff3-2147-4be7-b5e7-9cbd8a5dfd47_2">
          <text><![CDATA[-]]></text>
        </inputEntry>
        <inputEntry id="inputEntry_54b2b691-2de5-4a2a-a63b-4ebc82731a90_2">
          <text><![CDATA[-]]></text>
        </inputEntry>
        <outputEntry id="outputEntry_de383d7f-32e3-44e2-9c50-d5611a2ab588_2">
          <text><![CDATA["A"]]></text>
        </outputEntry>
      </rule>
    </decisionTable>
  </decision>
  <dmndi:DMNDI></dmndi:DMNDI>
</definitions>

Do you have any custom configuration in place?
I tested this dmn file quickly with a (default) Spring Boot app and it auto-deployed fine.

What engine version are you using?
Is that an older version than the Flowable version used for creating the decision table?

I am using latest flowable enterprise edition trial (Flowable design) to create the decision table.
Below is my spring boot app code.
POM file

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>2.2.7.RELEASE</version>
		<relativePath/> <!-- lookup parent from repository -->
	</parent>
	<groupId>com.flowable</groupId>
	<artifactId>spring-flowable-integration</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<packaging>war</packaging>

	<name>spring-flowable-integration</name>
	<description>Demo project for Spring Boot using Flowable BPM</description>

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
		<java.version>1.8</java.version>
		<flowable.version>6.5.0</flowable.version>
		<junit.version>4.13</junit.version>
		<junit.jupiter.version>5.3.2</junit.jupiter.version>
		<junit.vintage.version>5.3.2</junit.vintage.version>
	</properties>

	<dependencies>
		<!-- Starter for building web, including RESTful, applications using Spring MVC. Uses Tomcat as the default embedded container -->
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-web</artifactId>
		</dependency>
		<!-- Starter for building web, including RESTful, applications using Spring MVC. Uses Tomcat as the default embedded container -->

		<!-- H2 Database Engine -->
		<dependency>
			<groupId>com.h2database</groupId>
			<artifactId>h2</artifactId>
			<scope>runtime</scope>
		</dependency>
		<!-- H2 Database Engine -->

		<!-- Starter for using Tomcat as the embedded servlet container. Default servlet container starter used by spring-boot-starter-web -->
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-tomcat</artifactId>
		</dependency>
		<!-- Starter for using Tomcat as the embedded servlet container. Default servlet container starter used by spring-boot-starter-web -->

		<!-- Starter for testing Spring Boot applications with libraries including JUnit, Hamcrest and Mockito -->
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
			<exclusions>
				<exclusion>
					<groupId>org.junit.vintage</groupId>
					<artifactId>junit-vintage-engine</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<!-- Starter for testing Spring Boot applications with libraries including JUnit, Hamcrest and Mockito -->

		<!-- Flowable Spring Boot Starter Basic -->
		<dependency>
			<groupId>org.flowable</groupId>
			<artifactId>flowable-spring-boot-starter-basic</artifactId>
			<version>${flowable.version}</version>
		</dependency>
		<!-- Flowable Spring Boot Starter Basic -->

		<!-- Flowable Spring Boot Starter Rest Api -->
		<dependency>
			<groupId>org.flowable</groupId>
			<artifactId>flowable-spring-boot-starter-rest</artifactId>
			<version>${flowable.version}</version>
		</dependency>
		<!-- Flowable Spring Boot Starter Rest Api -->
		
		<dependency>
		    <groupId>org.flowable</groupId>
		    <artifactId>flowable-dmn-spring-configurator</artifactId>
		    <version>${flowable.version}</version>
		</dependency>

		<!-- Flowable Spring Boot Starter Actuator -->
		<dependency>
			<groupId>org.flowable</groupId>
			<artifactId>flowable-spring-boot-starter-actuator</artifactId>
			<version>${flowable.version}</version>
		</dependency>
		<!-- Flowable Spring Boot Starter Actuator -->

		<!-- Starter for using Spring Boot's Actuator which provides production ready features to help you monitor and manage your application -->
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-actuator</artifactId>
		</dependency>
		<!-- Starter for using Spring Boot's Actuator which provides production ready features to help you monitor and manage your application -->
		
		<dependency>
		  <groupId>org.slf4j</groupId>
		  <artifactId>slf4j-log4j12</artifactId>
		</dependency>

		<dependency>
			<groupId>org.junit.jupiter</groupId>
			<artifactId>junit-jupiter-api</artifactId>
			<version>${junit.jupiter.version}</version>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>${junit.version}</version>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>org.junit.jupiter</groupId>
			<artifactId>junit-jupiter-engine</artifactId>
			<version>${junit.jupiter.version}</version>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>org.junit.vintage</groupId>
			<artifactId>junit-vintage-engine</artifactId>
			<version>${junit.vintage.version}</version>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>org.awaitility</groupId>
			<artifactId>awaitility</artifactId>
		</dependency>

	</dependencies>

	<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
			</plugin>

			<plugin>
				<artifactId>maven-surefire-plugin</artifactId>
				<version>2.22.2</version>
			</plugin>

			<plugin>
				<artifactId>maven-failsafe-plugin</artifactId>
				<version>2.22.2</version>
			</plugin>
		</plugins>
	</build>

</project>

Controller

package com.flowable.springflowableintegration.rest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.flowable.springflowableintegration.domain.Group;
import com.flowable.springflowableintegration.domain.PV;
import com.flowable.springflowableintegration.service.AssignmentWorkflowService;

@RestController
public class AssignmentController {
	
	@Autowired
	private AssignmentWorkflowService service;

    @RequestMapping(value="/getAssignmentDetails", method= RequestMethod.POST,consumes= MediaType.APPLICATION_JSON_VALUE, produces= MediaType.APPLICATION_JSON_VALUE)
    public Group getAssignmentDetails(@RequestBody PV pv) {
    	service.startProcess(pv);
    	System.out.println(pv.toString());
        Group assignmentGroup = new Group("A");
        return assignmentGroup;
    }
}

Service


package com.flowable.springflowableintegration.service;

import org.flowable.engine.RuntimeService;
import org.flowable.engine.TaskService;
import org.flowable.task.api.Task;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.flowable.springflowableintegration.domain.PV;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class AssignmentWorkflowService {

    @Autowired
    private RuntimeService runtimeService;

    @Autowired
    private TaskService taskService;

    @Transactional
    public void startProcess(PV pv) {
    	 Map<String, Object> variables = new HashMap<String, Object>();
         variables.put("country", pv.getCountry());
         variables.put("reportType", pv.getReportType());
         variables.put("product", pv.getProduct());
         variables.put("therapeuticArea", pv.getTherapeuticArea());
         variables.put("seriousness", pv.getSeriousness());
         variables.put("receivedFrom", pv.getReceivedFrom());
         variables.put("forSubmissionTo", pv.getForSubmissionTo());
         runtimeService.startProcessInstanceByKey("groupAssignment", variables);
    }

}

Assignment_Group.bpmn20.xml

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:flowable="http://flowable.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" xmlns:design="http://flowable.org/design" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://flowable.org/test" design:palette="flowable-process-palette">
  <process id="assignmentGroup" name="Assignment Group" isExecutable="true" flowable:candidateStarterGroups="flowableUser">
    <extensionElements>
      <design:stencilid><![CDATA[BPMNDiagram]]></design:stencilid>
      <design:language><![CDATA[English]]></design:language>
      <design:creationdate><![CDATA[2021-09-15T05:32:41.878Z]]></design:creationdate>
      <design:modificationdate><![CDATA[2021-09-15T05:34:43.663Z]]></design:modificationdate>
    </extensionElements>
    <startEvent id="startnoneevent1" flowable:initiator="initiator" flowable:formFieldValidation="false">
      <extensionElements>
        <flowable:work-form-field-validation><![CDATA[false]]></flowable:work-form-field-validation>
        <design:stencilid><![CDATA[StartNoneEvent]]></design:stencilid>
      </extensionElements>
    </startEvent>
    <sequenceFlow id="sequenceFlow1" sourceRef="startnoneevent1" targetRef="scriptTask1">
      <extensionElements>
        <design:stencilid><![CDATA[SequenceFlow]]></design:stencilid>
      </extensionElements>
    </sequenceFlow>
    <scriptTask id="scriptTask1" name="Print" scriptFormat="java" flowable:autoStoreVariables="false">
      <extensionElements>
        <design:stencilid><![CDATA[ScriptTask]]></design:stencilid>
        <design:stencilsuperid><![CDATA[Task]]></design:stencilsuperid>
      </extensionElements>
      <script><![CDATA[System.out.println("Eureka");]]></script>
    </scriptTask>
    <endEvent id="endNoneEvent1">
      <extensionElements>
        <design:stencilid><![CDATA[EndNoneEvent]]></design:stencilid>
      </extensionElements>
    </endEvent>
    <sequenceFlow id="sequenceFlow2" sourceRef="scriptTask1" targetRef="endNoneEvent1">
      <extensionElements>
        <design:stencilid><![CDATA[SequenceFlow]]></design:stencilid>
      </extensionElements>
    </sequenceFlow>
  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_assignmentGroup">
    <bpmndi:BPMNPlane bpmnElement="assignmentGroup" id="BPMNPlane_assignmentGroup">
      <bpmndi:BPMNShape bpmnElement="startnoneevent1" id="BPMNShape_startnoneevent1">
        <omgdc:Bounds height="30.0" width="30.0" x="117.0" y="261.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="scriptTask1" id="BPMNShape_scriptTask1">
        <omgdc:Bounds height="80.0" width="100.0" x="192.0" y="236.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="endNoneEvent1" id="BPMNShape_endNoneEvent1">
        <omgdc:Bounds height="28.0" width="28.0" x="337.0" y="262.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="sequenceFlow1" id="BPMNEdge_sequenceFlow1">
        <omgdi:waypoint x="146.9499984899576" y="276.0"></omgdi:waypoint>
        <omgdi:waypoint x="191.9999999999917" y="276.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sequenceFlow2" id="BPMNEdge_sequenceFlow2">
        <omgdi:waypoint x="291.949999999934" y="276.0"></omgdi:waypoint>
        <omgdi:waypoint x="337.0" y="276.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>

Application properties

server.port=8081
# ===================================================================
# DATASOURCE (DataSourceAutoConfiguration & DataSourceProperties)
# ===================================================================
# spring.datasource.driver-class-name	= Fully qualified name of the JDBC driver. Auto-detected based on the URL by default.
# spring.datasource.password			= Login password of the database.
# spring.datasource.url					= JDBC url of the database.
# spring.datasource.username			= Login username of the database.
# ===================================================================
spring.datasource.username=flowable
spring.datasource.password=flowable
spring.datasource.url=jdbc:h2:~/flowable-db/db
spring.datasource.driver-class-name=org.h2.Driver

# ===================================================================
# H2 Database
# ===================================================================
spring.h2.console.enabled=true
spring.h2.console.path=/h2-console
spring.h2.console.settings.trace=true

# ===================================================================
# Core (Process) [FlowableProperties]
# ===================================================================
# flowable.deployment-name = The name of the auto deployment. Default is SpringBootAutoDeployment
# ===================================================================
flowable.deployment-name=SpringBootAutoDeployment

# ===================================================================
# Actuator
# ===================================================================
# management.endpoint.flowable.cache.time-to-live   = Maximum time that a response can be cached. Default is 0ms
# management.endpoint.flowable.enabled              = Whether to enable the flowable endpoint. Default is true
# ===================================================================
management.endpoint.flowable.cache.time-to-live=0ms
management.endpoint.flowable.enabled=true

# ===================================================================
# ENDPOINTS GENERAL CONFIGURATION
# ===================================================================
# management.endpoints.enabled-by-default	= Whether to enable or disable all endpoints by default.
# ===================================================================
management.endpoints.enabled-by-default=true

# ===================================================================
# ENDPOINTS WEB CONFIGURATION (WebEndpointProperties)
# ===================================================================
# management.endpoints.web.exposure.include	= Endpoint IDs that should be included or '*' for all.
# ===================================================================
management.endpoints.web.exposure.include=health,shutdown,env,info,flowable,mappings

# ===================================================================
# HEALTH ENDPOINT (HealthEndpoint, HealthEndpointProperties)
# ===================================================================
# management.endpoint.health.show-details	= When to show full health details. Default is never
# ===================================================================
management.endpoint.health.show-details=always

You are using the latest Flowable commercial tooling to create the definition. But you’re using a much older engines versions (6.5.0). The latest version is 6.7.0.
Please upgrade the engines to the latest version.

Another thing to consider is that executing definitions created with the commercial tooling on the open source engines may cause issues. For example’ the commercial palettes contain constructs not support by open source.

Thanks Yvo. Error related to DmnXMLException is fixed now after updating the version. But now I am getting the below error.

2021-09-15 17:00:10.340 ERROR 10772 — [ main] liquibase.license.LicenseServiceFactory : Unable to instantiate LicenseService

java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlElement

I think it because spring project is on open source and I am using the commercial tooling to generate the decision table.

How can I update my spring boot project to enterprise version? Can you please share some sample enterprise spring boot project?

No this does not seem to be causing the issue.
Take a look here to see if the cause (and solution) described here is the same.

Thanks Yvo. updating spring version fixed the issue.

Now my process is executing fine and also the decision table is executed. But I don’t see any flowable logs in console. How can I enable the detailed logs for debugging.

Also I want to fetch the output from decision table in my java code. I am using the below code to pass the processid and output variable name but getting the error “org.flowable.common.engine.api.FlowableObjectNotFoundException: execution 43a5fce1-16eb-11ec-9d43-0a8b24fd0ed7 doesn’t exist”


package com.flowable.springflowableintegration.service;

import org.flowable.engine.RuntimeService;
import org.flowable.engine.TaskService;
import org.flowable.engine.runtime.Execution;
import org.flowable.engine.runtime.ProcessInstance;
import org.flowable.task.api.Task;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.flowable.springflowableintegration.domain.PV;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class AssignmentWorkflowService {

    @Autowired
    private RuntimeService runtimeService;

    @Autowired
    private TaskService taskService;

    @Transactional
    public void startProcess(PV pv) {
    	 Map<String, Object> variables = new HashMap<String, Object>();
         variables.put("country", pv.getCountry());
         variables.put("reportType", pv.getReportType());
         variables.put("product", pv.getProduct());
         variables.put("therapeuticArea", pv.getTherapeuticArea());
         variables.put("seriousness", pv.getSeriousness());
         variables.put("receivedFrom", pv.getReceivedFrom());
         variables.put("forSubmissionTo", pv.getForSubmissionTo());
         ProcessInstance procInst= runtimeService.startProcessInstanceByKey("groupAssignment", variables);
         System.out.println("output "+runtimeService.getVariable(procInst.getId(), "group").toString());
    }
}

Your process instance is already finished (it does not have any constructs that puts it in a wait state).
Use the HistoryService to query for the variable.

HistoricVariableInstance groupVar = historyService.createHistoricVariableInstanceQuery().processInstanceId(procInst.getId()).variableName("group").singleResult();

Thanks a lot Yvo. It worked