{"record":{"id":"a7f7297fab3cd442","repo":"OtterMind/Chat2DB","slug":"error-creating-xml-document","errorCode":null,"errorMessage":"Error creating XML document","messagePattern":"Error creating XML document","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"critical","filePath":"chat2db-community-server/chat2db-community-domain/chat2db-community-domain-core/src/main/java/ai/chat2db/community/domain/core/impl/ncx/XMLUtils.java","lineNumber":64,"sourceCode":"            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();\n            dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);\n            dbf.setFeature(\"http://apache.org/xml/features/disallow-doctype-decl\", true);\n            dbf.setFeature(\"http://xml.org/sax/features/external-general-entities\", false);\n            dbf.setFeature(\"http://xml.org/sax/features/external-parameter-entities\", false);\n            DocumentBuilder xmlBuilder = dbf.newDocumentBuilder();\n            return xmlBuilder.parse(source);\n        } catch (Exception er) {\n            throw new RuntimeException(\"Error parsing XML document\", er);\n        }\n    }\n\n    public static Document createDocument() {\n        try {\n            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();\n            DocumentBuilder xmlBuilder = dbf.newDocumentBuilder();\n            return xmlBuilder.newDocument();\n        } catch (Exception er) {\n            throw new RuntimeException(\"Error creating XML document\", er);\n        }\n    }\n\n    public static Element getChildElement(Element element,  String childName) {\n        if (element == null) {\n            return null;\n        }\n        for (Node node = element.getFirstChild(); node != null; node = node.getNextSibling()) {\n            if (node.getNodeType() == Node.ELEMENT_NODE &&\n                ((Element) node).getTagName().equals(childName)) {\n                return (Element) node;\n            }\n        }\n        return null;\n    }\n\n    public static String getChildElementBody(Element element,  String childName) {\n        if (element == null) {","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/OtterMind/Chat2DB/blob/5ee1e990e73fbcae1969dc554be254fedb3ab888/chat2db-community-server/chat2db-community-domain/chat2db-community-domain-core/src/main/java/ai/chat2db/community/domain/core/impl/ncx/XMLUtils.java#L46-L82","documentation":"RuntimeException 'Error creating XML document' from XMLUtils.createDocument when DocumentBuilderFactory.newDocumentBuilder fails (ParserConfigurationException). This is a JVM/environment failure to obtain a document builder, not an input error.","triggerScenarios":"DocumentBuilder cannot be instantiated — typically a misconfigured or missing JAXP implementation on the classpath, or a system property selecting a non-existent factory.","commonSituations":"A JRE without the default JAXP provider; conflicting XML API jars on classpath; javax.xml.parsers.DocumentBuilderFactory system property pointing at a missing class.","solutions":["Ensure a JAXP implementation (JDK default or xerces/dom4j) is on the classpath.","Check/unset javax.xml.parsers.DocumentBuilderFactory overrides.","Resolve XML API version conflicts in the dependency tree."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// fail fast at startup if JAXP is unavailable\ntry { DocumentBuilderFactory.newInstance().newDocumentBuilder(); }\ncatch (ParserConfigurationException e) { throw new IllegalStateException(\"JAXP DocumentBuilder unavailable\", e); }","typeGuard":null,"tryCatchPattern":"try { return XMLUtils.createDocument(); }\ncatch (RuntimeException e) { // Error creating XML document\n    throw new IllegalStateException(\"XML writer unavailable on this JVM/classpath\", e);\n}","preventionTips":["Ship a JAXP implementation in the runtime classpath.","Avoid setting javax.xml.parsers.DocumentBuilderFactory to a missing class.","Resolve XML API version conflicts during build."],"tags":["xml","environment","jaxp","classpath"],"backgroundTag":null,"analyzedSha":"5ee1e990e73fbcae1969dc554be254fedb3ab888","analyzedAt":"2026-08-14T07:05:03.077Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}