flowable/flowable-engine · error · DmnXMLException

Error while reading the dmn xml file

Error message

Error while reading the dmn xml file

What it means

During schema validation in convertToDmnModel, an XMLStreamException from creating/advancing the XMLStreamReader (e.g. xif.createXMLStreamReader(in) failing or the safe-XML reader erroring) is wrapped as DmnXMLException "Error while reading the dmn xml file".

Solutions

  1. Verify the file parses with xmllint or an IDE before conversion
  2. Ensure the InputStreamProvider returns a valid, fresh stream
  3. Check the XML declaration (encoding=...) matches the actual bytes
  4. Inspect the wrapped XMLStreamException cause for the exact line/column

Example fix

// before
InputStreamProvider p = () -> brokenCorruptStream;
// after
InputStreamProvider p = () -> new FileInputStream(new File("decision.dmn.xml"));
Defensive patterns

Strategy: validation

Validate before calling

try (InputStream in = provider.getInputStream()) { Document d = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(in); } catch (Exception e) { throw new IllegalStateException("DMN file unreadable: " + e.getMessage(), e); }

Try / catch

try { converter.convertToDmnModel(provider, true, true); } catch (DmnXMLException e) { if (e.getCause() instanceof XMLStreamException) { log.error("Cannot read dmn xml file", e.getCause()); } }

Prevention

When it happens

Trigger: validateSchema=true and the XML reader cannot be created or advanced: malformed prolog, invalid XML declarations, or a reader-level failure before/while validateModel runs.

Common situations: Files that are not XML at all; XML with an invalid declaration line; corrupt stream from the InputStreamProvider; concurrent modification of the underlying resource during validation.

Related errors


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/01f1dc180dcd369c. Report an issue: GitHub.

Appendix: source

Thrown at modules/flowable-dmn-xml-converter/src/main/java/org/flowable/dmn/xml/converter/DmnXMLConverter.java:251

        if (xif.isPropertySupported(XMLConstants.ACCESS_EXTERNAL_DTD)) {
            xif.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, "");
        }
        
        if (xif.isPropertySupported(XMLConstants.ACCESS_EXTERNAL_SCHEMA)) {
            xif.setProperty(XMLConstants.ACCESS_EXTERNAL_SCHEMA, "");
        }

        if (validateSchema) {
            try (InputStreamReader in = new InputStreamReader(inputStreamProvider.getInputStream(), encoding)) {
                if (!enableSafeDmnXml) {
                    validateModel(inputStreamProvider);
                } else {
                    validateModel(xif.createXMLStreamReader(in));
                }
            } catch (UnsupportedEncodingException e) {
                throw new DmnXMLException("The dmn xml is not properly encoded", e);
            } catch (XMLStreamException e) {
                throw new DmnXMLException("Error while reading the dmn xml file", e);
            } catch (Exception e) {
                throw new DmnXMLException(e.getMessage(), e);
            }
        }
        // The input stream is closed after schema validation
        try (InputStreamReader in = new InputStreamReader(inputStreamProvider.getInputStream(), encoding)) {
            // XML conversion
            return convertToDmnModel(xif.createXMLStreamReader(in));
        } catch (UnsupportedEncodingException e) {
            throw new DmnXMLException("The dmn xml is not properly encoded", e);
        } catch (XMLStreamException e) {
            throw new DmnXMLException("Error while reading the dmn xml file", e);
        } catch (IOException e) {
            throw new DmnXMLException(e.getMessage(), e);
        }
    }

    public DmnDefinition convertToDmnModel(XMLStreamReader xtr) {

View on GitHub (pinned to d6d39ce1c6)