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?
For generating a diagram of a process instance this might be helpful Activiti/ProcessInstanceDiagramResource.java at 5.x · Activiti/Activiti · GitHub
Ask for and offer help to other Alfresco Process Services and Activiti Users and members of the Alfresco team.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.