hibernate/hibernate-orm · error · JndiNameException

JNDI name [${jndiName}] was not valid

Error message

JNDI name [${jndiName}] was not valid

What it means

Error "JNDI name [${jndiName}] was not valid" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/engine/jndi/internal/JndiServiceImpl.java:124

		}
	}

	private Name parseName(String jndiName, Context context) {
		try {
			final URI uri = new URI( jndiName );
			final String scheme = uri.getScheme();
			if ( scheme != null && (! allowedScheme( scheme ) ) ) {
				throw new JndiException( "JNDI lookups for scheme '" + scheme + "' are not allowed" );
			}
		}
		catch (URISyntaxException e) {
			//Ok
		}
		try {
			return context.getNameParser( "" ).parse( jndiName );
		}
		catch ( InvalidNameException e ) {
			throw new JndiNameException( "JNDI name [" + jndiName + "] was not valid", e );
		}
		catch ( NamingException e ) {
			throw new JndiException( "Error parsing JNDI name [" + jndiName + "]", e );
		}
	}

	private static boolean allowedScheme(final String scheme) {
		return switch ( scheme ) {
			case "java", "osgi" -> true;
			default -> false;
		};
	}

	private void cleanUp(InitialContext initialContext) {
		try {
			initialContext.close();
		}
		catch ( NamingException e ) {

View on GitHub (pinned to fad1729dce)

Solutions

  1. Correct the JNDI name syntax (illegal characters or malformed composite name)
  2. Validate the name against the naming provider's rules

When it happens

Trigger: Thrown at hibernate-core/src/main/java/org/hibernate/engine/jndi/internal/JndiServiceImpl.java:124 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/fcb2e7fd10b03d98. Report an issue: GitHub.