{"record":{"id":"fcb2e7fd10b03d98","repo":"hibernate/hibernate-orm","slug":"jndi-name-jndiname-was-not-valid","errorCode":null,"errorMessage":"JNDI name [${jndiName}] was not valid","messagePattern":"JNDI name \\[(.+?)\\] was not valid","errorType":"exception","errorClass":"JndiNameException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/engine/jndi/internal/JndiServiceImpl.java","lineNumber":124,"sourceCode":"\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 ) {\n\t\t\tcase \"java\", \"osgi\" -> true;\n\t\t\tdefault -> false;\n\t\t};\n\t}\n\n\tprivate void cleanUp(InitialContext initialContext) {\n\t\ttry {\n\t\t\tinitialContext.close();\n\t\t}\n\t\tcatch ( NamingException e ) {","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/engine/jndi/internal/JndiServiceImpl.java#L106-L142","documentation":"Error \"JNDI name [${jndiName}] was not valid\" thrown in hibernate/hibernate-orm.","triggerScenarios":"Thrown at hibernate-core/src/main/java/org/hibernate/engine/jndi/internal/JndiServiceImpl.java:124 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Correct the JNDI name syntax (illegal characters or malformed composite name)","Validate the name against the naming provider's rules"],"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"}