hibernate/hibernate-orm · error · HibernateException

resource + " not found"

Error message

resource + " not found"

What it means

Error "resource + " not found"" thrown in hibernate/hibernate-orm.

Source

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

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

		InputStream stream = null;
		final ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
		if ( classLoader != null ) {
			stream = classLoader.getResourceAsStream( stripped );
		}
		if ( stream == null ) {
			stream = Environment.class.getResourceAsStream( resource );
		}
		if ( stream == null ) {
			stream = Environment.class.getClassLoader().getResourceAsStream( stripped );
		}
		if ( stream == null ) {
			throw new HibernateException( resource + " not found" );
		}
		return stream;
	}


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

		InputStream stream = null;

		ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
		if ( classLoader != null ) {
			stream = classLoader.getResourceAsStream( resource );
			if ( stream == null && hasLeadingSlash ) {
				stream = classLoader.getResourceAsStream( stripped );
			}
		}

View on GitHub (pinned to fad1729dce)

Solutions

  1. Ensure the named resource is on the classpath/filesystem; correct the resource name/path.

When it happens

Trigger: Thrown at hibernate-core/src/main/java/org/hibernate/internal/util/ConfigHelper.java:123 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/8241a11b801815a2. Report an issue: GitHub.