hibernate/hibernate-orm · error · HibernateException

Unable to locate config file: " + path

Error message

Unable to locate config file: " + path

What it means

Error "Unable to locate config file: " + path" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/internal/util/ConfigHelper.java:93

		// Anywhere else we should look?
		return url;
	}

	/**
	 * Open an InputStream to the URL represented by the incoming path.  First makes a call
	 * to {@link #locateConfig(String)} in order to find an appropriate URL.
	 * {@link URL#openStream()} is then called to obtain the stream.
	 *
	 * @param path The path representing the config location.
	 *
	 * @return An input stream to the requested config resource.
	 *
	 * @throws HibernateException Unable to open stream to that resource.
	 */
	public static InputStream getConfigStream(final String path) throws HibernateException {
		final URL url = locateConfig( path );
		if ( url == null ) {
			throw new HibernateException( "Unable to locate config file: " + path );
		}
		try {
			return url.openStream();
		}
		catch (IOException e) {
			throw new HibernateException( "Unable to open config file: " + path, e );
		}
	}

	private ConfigHelper() {
	}

	public static InputStream getResourceAsStream(String resource) {
		final String stripped = resource.startsWith( "/" )
				? resource.substring( 1 )
				: resource;

		InputStream stream = null;

View on GitHub (pinned to fad1729dce)

Solutions

  1. Verify the config file path/classpath resource exists; correct the path passed to configure()/locateConfig.
  2. Package hibernate.cfg.xml (or the referenced file) on the classpath.

When it happens

Trigger: Thrown at hibernate-core/src/main/java/org/hibernate/internal/util/ConfigHelper.java:93 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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