hibernate/hibernate-orm · error · JndiException
Unanticipated error doing intermediate lookup
Error message
Unanticipated error doing intermediate lookup
What it means
While walking the JNDI tree to create missing parent contexts before binding, the lookup of an intermediate context name threw an unexpected NamingException (not NameNotFoundException, which is expected and handled). The cause carries the provider error.
Solutions
- Inspect the underlying NamingException cause for the intermediate context failure
- Ensure intermediate contexts in the JNDI path exist and are accessible
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at hibernate-core/src/main/java/org/hibernate/engine/jndi/internal/JndiServiceImpl.java:186 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/ebcf3a4dd1972a31.
Report an issue: GitHub.
Appendix: source
Thrown at hibernate-core/src/main/java/org/hibernate/engine/jndi/internal/JndiServiceImpl.java:186
throw new JndiException( "Error performing bind [" + name + "]", initialException );
}
// Otherwise, there is a good chance this may have been caused by missing intermediate contexts. So we
// attempt to create those missing intermediate contexts and bind again
Context intermediateContextBase = context;
while ( name.size() > 1 ) {
final String intermediateContextName = name.get( 0 );
Context intermediateContext = null;
try {
CORE_LOGGER.tracef( "Intermediate lookup: %s", intermediateContextName );
intermediateContext = (Context) intermediateContextBase.lookup( intermediateContextName );
}
catch ( NameNotFoundException handledBelow ) {
// ok as we will create it below if not found
}
catch ( NamingException e ) {
throw new JndiException( "Unanticipated error doing intermediate lookup", e );
}
if ( intermediateContext != null ) {
CORE_LOGGER.tracef( "Found intermediate context: %s", intermediateContextName );
}
else {
CORE_LOGGER.tracef( "Creating subcontext: %s", intermediateContextName );
try {
intermediateContext = intermediateContextBase.createSubcontext( intermediateContextName );
}
catch ( NamingException e ) {
throw new JndiException( "Error creating intermediate context [" + intermediateContextName + "]", e );
}
}
intermediateContextBase = intermediateContext;
name = name.getSuffix( 1 );
}
CORE_LOGGER.tracef( "Binding: %s", name );View on GitHub (pinned to fad1729dce)