hibernate/hibernate-orm · error · XsdException

Unable to load schema [%s]

Error message

Unable to load schema [%s]

What it means

Error "Unable to load schema [%s]" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/boot/cfgxml/internal/JaxbCfgProcessor.java:166

	}

	private Schema resolveLocalSchema(String schemaName) {
		return resolveLocalSchema( schemaName, W3C_XML_SCHEMA_NS_URI );
	}

	private Schema resolveLocalSchema(String schemaName, String schemaLanguage) {
		final URL url = classLoaderService.locateResource( schemaName );
		if ( url == null ) {
			throw new XsdException( "Unable to locate schema [" + schemaName + "] via classpath", schemaName );
		}
		try {
			final var schemaStream = url.openStream();
			try {
				return SchemaFactory.newInstance( schemaLanguage )
						.newSchema( new StreamSource( url.openStream() ) );
			}
			catch ( SAXException | IOException e ) {
				throw new XsdException( "Unable to load schema [" + schemaName + "]", e, schemaName );
			}
			finally {
				try {
					schemaStream.close();
				}
				catch ( IOException e ) {
					JAXB_LOGGER.problemClosingSchemaStream( e.toString() );
				}
			}
		}
		catch ( IOException e ) {
			throw new XsdException( "Stream error handling schema url [" + url.toExternalForm() + "]", schemaName );
		}
	}

	static class ContextProvidingValidationEventHandler implements ValidationEventHandler {
		private int lineNumber;
		private int columnNumber;

View on GitHub (pinned to fad1729dce)

Solutions

  1. Check that the XSD file is readable and not corrupted inside the deployed jar.
  2. Verify XML parser (SAX) availability and version compatibility on the classpath.
  3. Review the causal exception for I/O or parse errors in the schema itself.

When it happens

Trigger: The XSD schema used to validate the configuration cannot be located or loaded.

Common situations: Custom schema resolution failing because the schema resource is missing from the classpath or the schema URL is unreachable.


AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22). Data as JSON: /api/errors/4d3c16a554e20b32. Report an issue: GitHub.