{"record":{"id":"472512027643324c","repo":"flowable/flowable-engine","slug":"bpmn-xsd-could-not-be-found","errorCode":null,"errorMessage":"BPMN XSD could not be found","messagePattern":"BPMN XSD could not be found","errorType":"exception","errorClass":"XMLException","httpStatus":null,"severity":"critical","filePath":"modules/flowable-bpmn-converter/src/main/java/org/flowable/bpmn/converter/BpmnXMLConverter.java","lineNumber":259,"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(BPMN_XSD));\n        }\n\n        if (schema == null) {\n            schema = factory.newSchema(BpmnXMLConverter.class.getClassLoader().getResource(BPMN_XSD));\n        }\n\n        if (schema == null) {\n            throw new XMLException(\"BPMN XSD could not be found\");\n        }\n        return schema;\n    }\n\n    public BpmnModel convertToBpmnModel(InputStreamProvider inputStreamProvider, boolean validateSchema, boolean enableSafeBpmnXml) {\n        return convertToBpmnModel(inputStreamProvider, validateSchema, enableSafeBpmnXml, DEFAULT_ENCODING);\n    }\n\n    public BpmnModel convertToBpmnModel(InputStreamProvider inputStreamProvider, boolean validateSchema, boolean enableSafeBpmnXml, String encoding) {\n        XMLInputFactory xif = XMLInputFactory.newInstance();\n\n        if (xif.isPropertySupported(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES)) {\n            xif.setProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES, false);\n        }\n\n        if (xif.isPropertySupported(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES)) {\n            xif.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false);\n        }","sourceCodeStart":241,"sourceCodeEnd":277,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-bpmn-converter/src/main/java/org/flowable/bpmn/converter/BpmnXMLConverter.java#L241-L277","documentation":"BpmnXMLConverter.createSchema()/schema() lazily loads the BPMN 2.0 XSD from the classpath (BPMN_XSD resource). If the resource cannot be found on the classloader, the resulting Schema is null and an XMLException is thrown, since schema validation is impossible without the XSD.","triggerScenarios":"Calling convertToBpmnModel/validateSchema (via schema()) when the classpath resource for the BPMN XSD is missing — typically a broken/partial flowable-bpmn-converter jar, shaded/fat-jar packaging that excluded .xsd resources, or a custom classloader that cannot see the resource.","commonSituations":"Fat-jar/uber-jar builds with resource filtering or excludes dropping XSD files; OSGi/app-server classloader isolation; corrupted maven artifacts; running with a stripped-down classpath.","solutions":["Verify the flowable-bpmn-converter jar contains the BPMN XSD resource (unzip and look for the xsd path referenced by BPMN_XSD)","Rebuild/re-download dependencies to replace a corrupted artifact","Fix maven-shade/assembly resource excludes or filtering so .xsd files are packaged","Ensure the classloader used can see converter jar resources (check app-server/OSGi classloading)","Add the full unmodified flowable-bpmn-converter dependency instead of copying classes manually"],"exampleFix":"// pom.xml — before (resource filtering breaks XSDs)\n<resource><directory>src/main/resources</directory><filtering>true</filtering></resource>\n// after — exclude binaries/xsd from filtering\n<resource>\n  <directory>src/main/resources</directory>\n  <filtering>true</filtering>\n  <excludes><exclude>**/*.xsd</exclude></excludes>\n</resource>\n<resource>\n  <directory>src/main/resources</directory>\n  <filtering>false</filtering>\n  <includes><include>**/*.xsd</include></includes>\n</resource>","handlingStrategy":"validation","validationCode":"String xsdPath = \"org/flowable/bpmn/converter/BPMN20.xsd\"; // value of BpmnXMLConverter.BPMN_XSD\nif (BpmnXMLConverter.class.getClassLoader().getResource(xsdPath) == null) {\n    throw new IllegalStateException(\"BPMN XSD missing from classpath; check packaging of flowable-bpmn-converter\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    converter.convertToBpmnModel(inputStreamProvider, true, false);\n} catch (XMLException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"BPMN XSD could not be found\")) {\n        throw new IllegalStateException(\"Classpath is missing the BPMN XSD; fix jar packaging/classloading\", e);\n    }\n    throw e;\n}","preventionTips":["After building fat jars, verify .xsd resources are present in the artifact","Avoid resource filtering on third-party resources when using maven-shade/assembly","Do not strip or hand-copy flowable-bpmn-converter classes without its resources","Test BPMN XML validation in the same (shaded/containerized) runtime used in production"],"tags":["java","flowable","bpmn","classpath","xsd","packaging"],"backgroundTag":"resource-not-found","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}