Null pointer exception at org.flowable.image.impl.DefaultProcessDiagramGenerator.initProcessDiagramCanvas

Hello everyone,

I am currently trying to get the diagram of the workflow.

current environment: Spring boot with Kotlin.

val process: ProcessDefinition? =

val bpmnModel: BpmnModel? =myService?.getRepositoryService()?.getBpmnModel(process?.id)

val processDiagramGenerator: ProcessDiagramGenerator = DefaultProcessDiagramGenerator()
val inputSt = processDiagramGenerator.generateJpgDiagram(bpmnModel)// here is where the exception happens

Following is a picture from where the exception first starts

Thank you for your help


Does every flowNode has graphic info associated in your process model?
(I think the issue can be easily reproducible in the jUnit test)


Hello thank you for the fast reply.
I used the BpmnAutoLayout class to solve the problem.

Below is the code for anyone who might face the same problem in the future.
Basically this code retrieves the workflow diagram image and then return it as an array of Bytes.

Since I am using spring boot, I had to add the following Maven dependency in order to be able to import the BpmnAutoLayout class:

 val process: ProcessDefinition? =

        val bpmnModel: BpmnModel? = myService?.getRepositoryService()?.getBpmnModel(process?.id)

        val bpmnLayout: BpmnAutoLayout = BpmnAutoLayout(bpmnModel)
        bpmnLayout.taskHeight = 120
        bpmnLayout.taskWidth = 120

        val processDiagramGenerator: ProcessDiagramGenerator = DefaultProcessDiagramGenerator()
        val inputSt = processDiagramGenerator.generateJpgDiagram(bpmnModel)

            val bos = ByteArrayOutputStream()

  , bos)
            return bos.toByteArray()