Spring Boot 2.0.2 + Flowable 6.3.1 Process Deployment

I am trying to integrate Spring Boot 2.0.2 with Flowable 6.3.1. and running into a problem where I am unable to deploy a process one-task-process.bpmn20.xml from the resources/processes/ folder. The XML file is not being picked up and the error says:

Caused by: org.flowable.engine.common.api.FlowableIllegalArgumentException: resource 'one-task-process.bpmn20.xml' not found
    at org.flowable.engine.impl.repository.DeploymentBuilderImpl.addClasspathResource(DeploymentBuilderImpl.java:80) ~[flowable-engine-6.3.0.jar:6.3.0]
    at com.stsi.pss.Application$1.run(Application.java:458) ~[classes/:na]
    at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:797) [spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
    ... 10 common frames omitted

My Spring Boot Application Starter file is as follows and it also prints out the class path which does not include the processes folder.

imports...

@Configuration
@ComponentScan
@EnableAutoConfiguration
@SpringBootApplication
public class Application {

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }

    @Bean
    public CommandLineRunner init(final RepositoryService repositoryService,
                                  final RuntimeService runtimeService,
                                  final TaskService taskService) {

        return new CommandLineRunner() {
            @Override
            public void run(String... strings) throws Exception {

                ClassLoader cl = ClassLoader.getSystemClassLoader();

                URL[] urls = ((URLClassLoader)cl).getURLs();

                for(URL url: urls){
                    System.out.println(url.getFile());
                }

                System.out.println("Number of process definitions : "
                        + repositoryService.createProcessDefinitionQuery().count());
                System.out.println("Number of tasks : " + taskService.createTaskQuery().count());
                runtimeService.startProcessInstanceByKey("oneTaskProcess");
                System.out.println("Number of tasks after process start: "
                        + taskService.createTaskQuery().count());
            }
        };
    }
}

I would appreciate any help.

You said that you’re using Flowable 6.3.1 but in log there is 6.3.0.

That’s correct - good cach. I am having the same problems with 6.3.1. Here is the error:

Caused by: org.flowable.common.engine.api.FlowableObjectNotFoundException: no processes deployed with key ‘oneTaskProcess’
at org.flowable.engine.impl.persistence.deploy.DeploymentManager.findDeployedLatestProcessDefinitionByKey(DeploymentManager.java:89) ~[flowable-engine-6.3.1.jar:6.3.1]
at org.flowable.engine.impl.cmd.StartProcessInstanceCmd.execute(StartProcessInstanceCmd.java:91) ~[flowable-engine-6.3.1.jar:6.3.1]
at org.flowable.engine.impl.cmd.StartProcessInstanceCmd.execute(StartProcessInstanceCmd.java:38) ~[flowable-engine-6.3.1.jar:6.3.1]
at org.flowable.engine.impl.interceptor.CommandInvoker$1.run(CommandInvoker.java:51) ~[flowable-engine-6.3.1.jar:6.3.1]
at org.flowable.engine.impl.interceptor.CommandInvoker.executeOperation(CommandInvoker.java:93) ~[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.6.RELEASE.jar:5.0.6.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.RuntimeServiceImpl.startProcessInstanceByKey(RuntimeServiceImpl.java:95) ~[flowable-engine-6.3.1.jar:6.3.1]
at com.stsi.pss.Application$1.run(Application.java:460) ~[classes/:na]
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:797) [spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
… 10 common frames omitted

How do you run your application ? With java -jar …, mvn spring-boot:run, gradle bootRun ?
Processes folder won’t be printed cause it is nested in /classes directory. You should see path/classes on classpath.

Btw. @ComponentScan and @EnableAutoConfiguration are redundant. @EnableAutoConfiguration applies those annotations.

What’s the output of this one ?

And check process definition xml.
Is there <process id=“oneTaskProcess” ?

Or add this one to your code:

System.out.println("Definitions names : "
+ repositoryService.createProcessDefinitionQuery().list().stream().map(ProcessDefinition::getKey).collect(Collectors.joining()));

1 Like

Here are the results:

Number of process definitions : 1
Number of tasks : 0
Definitions names : hireProcess

After the above, the application failed because it was trying to start a process with “key” (not id) oneTaskProcess.

Here is the xml:

<?xml version="1.0" encoding="UTF-8"?>
<process id="oneTaskProcess" name="The One Task Process">
    <startEvent id="theStart" />
    <sequenceFlow id="flow1" sourceRef="theStart" targetRef="theTask" />
    <userTask id="theTask" name="my task" />
    <sequenceFlow id="flow2" sourceRef="theTask" targetRef="theEnd" />
    <endEvent id="theEnd" />
</process>

Also, there already seems to be a process named oneTaskProcess deployed when I look at the definitions section of the Process Engine. It’s
ID: oneTaskProcess:1:95bc2562-9bed-11e8-b1d9-70c94effb381
Key: OneTaskProcess

I tried another process hireProcess this morning, but not for the last few hours. I am not sure why the definitions is showing hireProcess which is a different process and which I thought was never deployed successfully (same problem I am having now).

Resolved this issue. I had named the BPMN file incorrectly.

Hi,I encountered the same problem when using Springboot 2.1.6 integrated flowable to upload and publish bpmn20.xml using Repository Service’s addInputStream method. the output of System. out. println (“Number of process definitions:” +repositoryService. createProcessDefinitionQuery (). count ()); is 1.

But the output of System. out. println (“Definitions names:”)

+ RepositoryService. createProcessDefinitionQuery (). list (). stream (). map (ProcessDefinition:: getKey). collect (Collectors. joining ()) is empty.

When i put bpmn20.xml in the processes folder of resource, everything works.
why?

I have found the problem that the first parameter resourceName of the addInputStream method of RepositoryService should be defined as the file name of the bpmn20.xml file.

Thank you. Good luck.