flowable/flowable-engine · error · FlowableException
Error while evaluating the following XPath expression on a B
Error message
Error while evaluating the following XPath expression on a BPMN XML document: '<expression>'.
What it means
fixFlowNodePositionsIfModelFromAdonis adjusts element coordinates for diagrams exported from the Adonis tool by evaluating XPath expressions against the parsed BPMN DOM. If an XPath expression fails to evaluate (XPathExpressionException), Flowable wraps it in this FlowableException including the failing expression.
Source
Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/diagram/ProcessDiagramLayoutFactory.java:346
protected Map<String, DiagramNode> fixFlowNodePositionsIfModelFromAdonis(Document bpmnModel, Map<String, DiagramNode> elementBoundsFromBpmnDi) {
if (isExportedFromAdonis50(bpmnModel)) {
Map<String, DiagramNode> mapOfFixedBounds = new HashMap<>();
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 FlowableException("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
- Inspect the failing expression in the message and compare against the actual XML structure/namespace prefixes of your Adonis export
- Re-export the diagram from Adonis in standard BPMN 2.0 DI format so the Adonis-specific fix-up path is not needed
- Normalize namespace prefixes in the XML before layout processing
- Open the diagram in a BPMN editor (e.g. Flowable Modeler) and re-save to produce canonical XML
Example fix
// before: feeding Adonis export directly factory.getBpmnProcessDiagramLayout(adonisXmlStream, imageStream); // after: use standard BPMN 2.0 DI export factory.getBpmnProcessDiagramLayout(standardBpmnXmlStream, imageStream);
Defensive patterns
Strategy: validation
Validate before calling
// Prefer standard BPMN 2.0 DI exports; detect Adonis output and re-export first
if (xml.contains("adonis") || usesAdonisLayout(xml)) {
throw new IllegalArgumentException("Re-export diagram in standard BPMN 2.0 DI before layout processing");
} Try / catch
try {
layout = factory.getProcessDiagramLayout(xmlStream, imageStream);
} catch (FlowableException e) {
if (e.getMessage().contains("XPath expression")) {
// fall back to default layout or re-export the diagram
}
} Prevention
- Use standard BPMN 2.0 DI exports rather than Adonis-specific output
- Re-save Adonis diagrams in a standard BPMN editor before deployment
- Keep namespace prefixes consistent when generating BPMN XML
When it happens
Trigger: getBpmnProcessDiagramLayout processes an Adonis-exported BPMN diagram whose element references or namespaces make one of the hardcoded XPath expressions fail during evaluation.
Common situations: BPMN diagrams exported from Adonis with non-standard namespace prefixes; elements missing expected id attributes; Adonis version differences changing the XML structure the XPath expects.
Related errors
- Error while evaluating the following XPath expression on a B
- Error while parsing BPMN model.
- The bpmn 2.0 xml is not properly encoded
- Error while reading the BPMN 2.0 XML
- e.getMessage()
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/f9d7a590bc4030fb.
Report an issue: GitHub.