hibernate/hibernate-orm · error · ConfigurationException

Could not access given cfg.xml URL input stream

Error message

Could not access given cfg.xml URL input stream

What it means

Error "Could not access given cfg.xml URL input stream" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/boot/cfgxml/internal/ConfigLoader.java:108

	public LoadedConfig loadConfigXmlUrl(URL url) {
		try {
			final var stream = url.openStream();
			try {
				return LoadedConfig.consume( jaxbProcessorHolder.getValue()
						.unmarshal( stream, new Origin( URL, url.toExternalForm() ) ) );
			}
			finally {
				try {
					stream.close();
				}
				catch (IOException e) {
					BOOT_LOGGER.unableToCloseCfgXmlUrlStream( e );
				}
			}
		}
		catch (IOException e) {
			throw new ConfigurationException( "Could not access given cfg.xml URL input stream", e );
		}
	}

	public Properties loadProperties(String resourceName) {
		final var stream = locateStream( resourceName );
		if ( stream == null ) {
			throw new ConfigurationException( "Unable to apply settings from properties file [" + resourceName + "]" );
		}

		try {
			return loadProperties( stream );
		}
		catch (IOException e) {
			throw new ConfigurationException( "Unable to apply settings from properties file [" + resourceName + "]", e );
		}
		finally {
			try {
				stream.close();

View on GitHub (pinned to fad1729dce)

Solutions

  1. Check the URL passed to configure(URL) is reachable and readable (network access, file permissions).
  2. Verify the URL protocol is correct and the resource behind it is not blocked by a firewall or security manager.
  3. Test opening the URL independently (e.g. curl or url.openStream()) to isolate the access problem.

When it happens

Trigger: A configuration resource (cfg.xml URL or properties file) cannot be opened or read.

Common situations: Unreadable or missing config files, wrong URLs, or IO errors while Hibernate loads settings during bootstrap.


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