hibernate/hibernate-orm · error · JndiException

Error parsing JNDI name [${jndiName}]

Error message

Error parsing JNDI name [${jndiName}]

What it means

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

Source

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

	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 ) {
			CORE_LOGGER.unableToCloseInitialContext(e.toString());
		}
	}

View on GitHub (pinned to fad1729dce)

Solutions

  1. Fix the JNDI name so it parses correctly
  2. Check for invalid characters or misplaced separators in the name

When it happens

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