Nullpointer DefaultProcessDiagramGenerator

cancel
Showing results for 
Search instead for 
Did you mean: 
kroninho
Member II

Nullpointer DefaultProcessDiagramGenerator

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?

1 Reply
bassam_al-saror
Alfresco Employee

Re: Nullpointer DefaultProcessDiagramGenerator

For generating a diagram of a process instance this might be helpful Activiti/ProcessInstanceDiagramResource.java at 5.x · Activiti/Activiti · GitHub