AnsweredAssumed Answered

Nullpointer DefaultProcessDiagramGenerator

Question asked by kroninho on Aug 7, 2018
Latest reply on Aug 8, 2018 by bassam.al-sarori

Hi, I am Using Activiti 5.22 and I want to create a process diagram using the DefaultProcessDiagramGenerator. When I call the generateDiagram Method I get a NullPointerException.

 

Caused by: java.lang.NullPointerException
at org.activiti.image.impl.DefaultProcessDiagramGenerator.initProcessDiagramCanvas(DefaultProcessDiagramGenerator.java:810) [activiti-image-generator-5.22.0.jar:5.22.0]
at org.activiti.image.impl.DefaultProcessDiagramGenerator.generateProcessDiagram(DefaultProcessDiagramGenerator.java:475) [activiti-image-generator-5.22.0.jar:5.22.0]
at org.activiti.image.impl.DefaultProcessDiagramGenerator.generateDiagram(DefaultProcessDiagramGenerator.java:403) [activiti-image-generator-5.22.0.jar:5.22.0]
at org.activiti.image.impl.DefaultProcessDiagramGenerator.generateDiagram(DefaultProcessDiagramGenerator.java:408) [activiti-image-generator-5.22.0.jar:5.22.0]
at org.activiti.image.impl.DefaultProcessDiagramGenerator.generateDiagram(DefaultProcessDiagramGenerator.java:417) [activiti-image-generator-5.22.0.jar:5.22.0]

 

My method to get the process diagram:

public byte[] getProcessDiagram(final String pProcessInstanceId) {
   RepositoryService lRepService = ProcessEngineManager.getEngine().getRepositoryService();
   RuntimeService lRuntimeService = ProcessEngineManager.getEngine().getRuntimeService();

   byte[] data = null;
   ProcessInstance pi =    lRuntimeService.createProcessInstanceQuery().processInstanceId(pProcessInstanceId).singleResult();
   ProcessDiagramGenerator processDiagramGenerator = new DefaultProcessDiagramGenerator();
   BpmnModel model = lRepService.getBpmnModel(pi.getProcessDefinitionId());
   InputStream is = processDiagramGenerator.generateDiagram(model, "png",    lRuntimeService.getActiveActivityIds(pi.getId()));
   data = IoUtil.readInputStream(is, "ProcessDiagram");
   try {
      is.close();
   } catch (IOException e) {
   e.printStackTrace();
   }
   return data;
}

 

I attached my BPM Model.

The DefaultProcessDiagramGenerator needs the bpmndi:BPMNDiagram tags, I'm right?

 

Does somebody has any idea?

Outcomes