{"record":{"id":"9aafea345a0cde31","repo":"hibernate/hibernate-orm","slug":"unable-to-create-stax-reader","errorCode":null,"errorMessage":"Unable to create StAX reader","messagePattern":"Unable to create StAX reader","errorType":"exception","errorClass":"HibernateException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/boot/cfgxml/internal/JaxbCfgProcessor.java","lineNumber":74,"sourceCode":"\t\tthis.xmlResourceResolver = new LocalXmlResourceResolver( classLoaderService );\n\t}\n\n\tpublic JaxbCfgHibernateConfiguration unmarshal(InputStream stream, Origin origin) {\n\t\ttry {\n\t\t\tfinal var staxReader = staxFactory().createXMLEventReader( stream );\n\t\t\ttry {\n\t\t\t\treturn unmarshal( staxReader, origin );\n\t\t\t}\n\t\t\tfinally {\n\t\t\t\ttry {\n\t\t\t\t\tstaxReader.close();\n\t\t\t\t}\n\t\t\t\tcatch ( Exception ignore ) {\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tcatch ( XMLStreamException e ) {\n\t\t\tthrow new HibernateException( \"Unable to create StAX reader\", e );\n\t\t}\n\t}\n\n\tprivate XMLInputFactory staxFactory;\n\n\tprivate XMLInputFactory staxFactory() {\n\t\tif ( staxFactory == null ) {\n\t\t\tstaxFactory = buildStaxFactory();\n\t\t}\n\t\treturn staxFactory;\n\t}\n\n\tprivate XMLInputFactory buildStaxFactory() {\n\t\tfinal var staxFactory = XMLInputFactory.newInstance();\n\t\tstaxFactory.setXMLResolver( xmlResourceResolver );\n\t\treturn staxFactory;\n\t}\n","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/boot/cfgxml/internal/JaxbCfgProcessor.java#L56-L92","documentation":"Error \"Unable to create StAX reader\" thrown in hibernate/hibernate-orm.","triggerScenarios":"The JDK StAX parser fails while reading a Hibernate XML configuration file.","commonSituations":"Malformed XML in hibernate.cfg.xml, or XML parser/dependency conflicts on the classpath.","solutions":["Ensure a StAX implementation is available on the classpath (JREs normally bundle one; on trimmed runtimes add e.g. woodstox).","Check for XML parser conflicts caused by shaded or old xerces/xalan jars; remove duplicates.","Inspect the causal exception for I/O problems reading the cfg.xml input."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}