flowable/flowable-engine · error · ActivitiException
Error while evaluating the following XPath expression on a B
Error message
Error while evaluating the following XPath expression on a BPMN XML document: '%s'.
What it means
fixFlowNodePositionsIfModelFromAdonis applies Adonis-import corrections by evaluating XPath expressions against the BPMN DOM. Any XPathExpressionException during evaluation is wrapped in an ActivitiException naming the failing expression.
Source
Thrown at modules/flowable5-engine/src/main/java/org/activiti/engine/impl/bpmn/diagram/ProcessDiagramLayoutFactory.java:346
XPathFactory xPathFactory = XPathFactory.newInstance();
XPath xPath = xPathFactory.newXPath();
xPath.setNamespaceContext(new Bpmn20NamespaceContext());
for (Entry<String, DiagramNode> entry : elementBoundsFromBpmnDi.entrySet()) {
String elementId = entry.getKey();
DiagramNode elementBounds = entry.getValue();
String expression = "local-name(//bpmn:*[@id = '" + elementId + "'])";
try {
XPathExpression xPathExpression = xPath.compile(expression);
String elementLocalName = xPathExpression.evaluate(bpmnModel);
if (!"participant".equals(elementLocalName)
&& !"lane".equals(elementLocalName)
&& !"textAnnotation".equals(elementLocalName)
&& !"group".equals(elementLocalName)) {
elementBounds.setX(elementBounds.getX() - elementBounds.getWidth() / 2);
elementBounds.setY(elementBounds.getY() - elementBounds.getHeight() / 2);
}
} catch (XPathExpressionException e) {
throw new ActivitiException("Error while evaluating the following XPath expression on a BPMN XML document: '" + expression + "'.", e);
}
mapOfFixedBounds.put(elementId, elementBounds);
}
return mapOfFixedBounds;
} else {
return elementBoundsFromBpmnDi;
}
}
protected boolean isExportedFromAdonis50(Document bpmnModel) {
return "ADONIS".equals(bpmnModel.getDocumentElement().getAttribute("exporter"))
&& "5.0".equals(bpmnModel.getDocumentElement().getAttribute("exporterVersion"));
}
}
View on GitHub (pinned to d6d39ce1c6)
Solutions
- Verify the BPMN XML actually comes from an Adonis import before this correction path runs
- Check the document contains the elements/namespaces the XPath targets
- Regenerate the diagram DI section with a standard BPMN tool to bypass the Adonis fix-up
Defensive patterns
Strategy: try-catch
Try / catch
try {
layout = factory.getProcessDiagramLayout(bpmnStream, imageStream);
} catch (org.activiti.engine.ActivitiException e) {
if (e.getMessage().startsWith("Error while evaluating the following XPath")) {
// document is not Adonis-generated or DI section is malformed; use standard layout
}
} Prevention
- Only run Adonis-imported models through this path
- Check that DI sections contain the expected elements/namespaces
- Prefer standard BPMN DI output from modeling tools
When it happens
Trigger: fixFlowNodePositionsIfModelFromAdonis, when an XPath expression does not compile against the document context or fails during evaluation of the Adonis-style BPMN DI document.
Common situations: BPMN DI documents lacking the namespaces/attributes the Adonis-specific XPath expects; documents not actually produced by Adonis import; engine/JDK XPath behavior differences.
Related errors
- Error while evaluating the following XPath expression on a B
- The bpmn 2.0 xml is not properly encoded
- Error while reading the BPMN 2.0 XML
- e.getMessage()
- Error reading XML
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/c8b07a66c8bd6361.
Report an issue: GitHub.