hibernate/hibernate-orm · error · JndiException

Error parsing JNDI name

Error message

Error parsing JNDI name [${jndiName}]

What it means

Generic wrap of a non-InvalidNameException NamingException raised while the JNDI name parser processes the name — covers provider-side parse failures other than plain invalid syntax. The cause carries the underlying exception.

Solutions

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

Strategy: try-catch

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.

Appendix: 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)