08-07-2018 03:53 AM
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?
08-08-2018 09:36 AM
For generating a diagram of a process instance this might be helpful Activiti/ProcessInstanceDiagramResource.java at 5.x · Activiti/Activiti · GitHub
Explore our Alfresco products with the links below. Use labels to filter content by product module.