{"record":{"id":"592833a0d668a3f1","repo":"flowable/flowable-engine","slug":"cmnd-xsd-could-not-be-found","errorCode":null,"errorMessage":"CMND XSD could not be found","messagePattern":"CMND XSD could not be found","errorType":"exception","errorClass":"CmmnXMLException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-converter/src/main/java/org/flowable/cmmn/converter/CmmnXmlConverter.java","lineNumber":276,"sourceCode":"        Schema schema = createSchema();\n\n        Validator validator = schema.newValidator();\n        validator.validate(new StAXSource(xmlStreamReader));\n    }\n\n    protected Schema createSchema() throws SAXException {\n        SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);\n        Schema schema = null;\n        if (classloader != null) {\n            schema = factory.newSchema(classloader.getResource(XSD_LOCATION));\n        }\n\n        if (schema == null) {\n            schema = factory.newSchema(this.getClass().getClassLoader().getResource(XSD_LOCATION));\n        }\n\n        if (schema == null) {\n            throw new CmmnXMLException(\"CMND XSD could not be found\");\n        }\n        return schema;\n    }\n\n    public byte[] convertToXML(CmmnModel model) {\n        return convertToXML(model, DEFAULT_ENCODING);\n    }\n\n    public byte[] convertToXML(CmmnModel model, String encoding) {\n        try {\n\n            ByteArrayOutputStream outputStream = new ByteArrayOutputStream();\n\n            XMLOutputFactory xof = XMLOutputFactory.newInstance();\n            OutputStreamWriter out = new OutputStreamWriter(outputStream, encoding);\n\n            XMLStreamWriter writer = xof.createXMLStreamWriter(out);\n            XMLStreamWriter xtw = new IndentingXMLStreamWriter(writer);","sourceCodeStart":258,"sourceCodeEnd":294,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-converter/src/main/java/org/flowable/cmmn/converter/CmmnXmlConverter.java#L258-L294","documentation":"When converting a CmmnModel back to XML, the converter lazily loads the CMMN 1.1 XSD from the classpath to build a javax.xml.validation.Schema. If the resource at XSD_LOCATION is missing from the classpath, this CmmnXMLException is thrown, meaning the Flowable cmmn-converter artifact or its schema resource is not on the runtime classpath.","triggerScenarios":"Calling convertToXML(model) (which validates against the schema) in an environment where the CMMN 1.1 XSD resource was excluded by build filtering/shading, or running with a repackaged jar that dropped resources.","commonSituations":"Shaded/fat-jar builds excluding .xsd resources, custom classloading that cannot see resources from the flowable-cmmn-converter jar, or partially extracted deployment archives.","solutions":["Ensure the full flowable-cmmn-converter dependency (including XSD resources) is packaged — check jar contents for the XSD","Fix maven-shade/assembly filters to stop excluding *.xsd","Verify the classloader used can load resources from the converter jar","Rebuild the deployment archive completely rather than patching files"],"exampleFix":"// before (maven-shade)\n<filter><exclude>*:*</exclude><excludes><exclude>*.xsd</exclude></excludes></filter>\n// after\n<!-- remove the *.xsd exclusion so the CMMN 1.1 schema ships in the jar -->","handlingStrategy":"validation","validationCode":"String xsdPath = \"org/flowable/cmmn/schema/CMMN11.xsd\"; // matches converter XSD_LOCATION\nif (getClass().getClassLoader().getResource(xsdPath) == null)\n    throw new IllegalStateException(\"CMMN 1.1 XSD missing from classpath: \" + xsdPath);","typeGuard":null,"tryCatchPattern":"try {\n    byte[] xml = converter.convertToXML(model);\n} catch (CmmnXMLException e) {\n    if (e.getMessage().contains(\"XSD could not be found\"))\n        throw new IllegalStateException(\"flowable-cmmn-converter resources missing from classpath\", e);\n    throw e;\n}","preventionTips":["Do not exclude *.xsd resources in shade/assembly configs","After building fat jars, verify the XSD is present (jar tf app.jar | grep -i cmmn)","Deploy complete, unmodified converter artifacts"],"tags":["java","cmmn","xsd","classpath"],"backgroundTag":"file-not-found","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}