{"record":{"id":"980d51c9e351242c","repo":"hibernate/hibernate-orm","slug":"jndi-lookups-for-scheme-scheme-are-not-allowe","errorCode":null,"errorMessage":"JNDI lookups for scheme '${scheme}' are not allowed","messagePattern":"JNDI lookups for scheme '(.+?)' are not allowed","errorType":"exception","errorClass":"JndiException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/engine/jndi/internal/JndiServiceImpl.java","lineNumber":114,"sourceCode":"\t\t\tcleanUp( initialContext );\n\t\t}\n\t}\n\n\tprivate InitialContext buildInitialContext() {\n\t\ttry {\n\t\t\treturn initialContextSettings.size() == 0 ? new InitialContext() : new InitialContext( initialContextSettings );\n\t\t}\n\t\tcatch ( NamingException e ) {\n\t\t\tthrow new JndiException( \"Unable to open InitialContext\", e );\n\t\t}\n\t}\n\n\tprivate Name parseName(String jndiName, Context context) {\n\t\ttry {\n\t\t\tfinal URI uri = new URI( jndiName );\n\t\t\tfinal String scheme = uri.getScheme();\n\t\t\tif ( scheme != null && (! allowedScheme( scheme ) ) ) {\n\t\t\t\tthrow new JndiException( \"JNDI lookups for scheme '\" + scheme + \"' are not allowed\" );\n\t\t\t}\n\t\t}\n\t\tcatch (URISyntaxException e) {\n\t\t\t//Ok\n\t\t}\n\t\ttry {\n\t\t\treturn context.getNameParser( \"\" ).parse( jndiName );\n\t\t}\n\t\tcatch ( InvalidNameException e ) {\n\t\t\tthrow new JndiNameException( \"JNDI name [\" + jndiName + \"] was not valid\", e );\n\t\t}\n\t\tcatch ( NamingException e ) {\n\t\t\tthrow new JndiException( \"Error parsing JNDI name [\" + jndiName + \"]\", e );\n\t\t}\n\t}\n\n\tprivate static boolean allowedScheme(final String scheme) {\n\t\treturn switch ( scheme ) {","sourceCodeStart":96,"sourceCodeEnd":132,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/engine/jndi/internal/JndiServiceImpl.java#L96-L132","documentation":"Error \"JNDI lookups for scheme '${scheme}' are not allowed\" thrown in hibernate/hibernate-orm.","triggerScenarios":"Thrown at hibernate-core/src/main/java/org/hibernate/engine/jndi/internal/JndiServiceImpl.java:114 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use an allowed JNDI scheme, or add the scheme to the allowed schemes configuration","Perform the lookup without a URL scheme prefix"],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}