hibernate/hibernate-orm · error · ConfigurationException

Specified cfg.xml file [%s] does not exist

Error message

Specified cfg.xml file [%s] does not exist

What it means

Error "Specified cfg.xml file [%s] does not exist" thrown in hibernate/hibernate-orm.

Source

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

		}
		finally {
			try {
				stream.close();
			}
			catch (IOException e) {
				BOOT_LOGGER.unableToCloseCfgXmlResourceStream( e );
			}
		}
	}

	public LoadedConfig loadConfigXmlFile(File cfgXmlFile) {
		try ( FileInputStream cfgFileStream = new FileInputStream( cfgXmlFile ) ) {
			return LoadedConfig.consume( jaxbProcessorHolder.getValue()
					.unmarshal( cfgFileStream,
							new Origin( FILE, cfgXmlFile.getAbsolutePath() ) ) );
		}
		catch (FileNotFoundException e) {
			throw new ConfigurationException(
					"Specified cfg.xml file [" + cfgXmlFile.getAbsolutePath() + "] does not exist"
			);
		}
		catch (IOException e) {
			BOOT_LOGGER.unableToCloseCfgXmlUrlStream( e );
		}

		return null;
	}

	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 {

View on GitHub (pinned to fad1729dce)

Solutions

  1. Verify the cfg.xml file path given to configure(File) or configure(String) actually exists on disk.
  2. Use an absolute path or confirm the working directory when using relative paths.
  3. Regenerate or restore the hibernate.cfg.xml file if it was deleted or not deployed.

When it happens

Trigger: A hibernate.cfg.xml resource named in the configuration cannot be found.

Common situations: Referencing cfg.xml by a wrong classpath path or file path, or the file not being packaged into the deployment.


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