{"record":{"id":"7766293616c4c746","repo":"spring-projects/spring-framework","slug":"cannot-access-specified-node-path","errorCode":null,"errorMessage":"Cannot access specified node path [","messagePattern":"Cannot access specified node path \\[","errorType":"exception","errorClass":"BeanDefinitionStoreException","httpStatus":null,"severity":"error","filePath":"spring-beans/src/main/java/org/springframework/beans/factory/config/PreferencesPlaceholderConfigurer.java","lineNumber":135,"sourceCode":"\t * Resolve the given path and key against the given Preferences.\n\t * @param path the preferences path (placeholder part before '/')\n\t * @param key the preferences key (placeholder part after '/')\n\t * @param preferences the Preferences to resolve against\n\t * @return the value for the placeholder, or {@code null} if none found\n\t */\n\tprotected @Nullable String resolvePlaceholder(@Nullable String path, String key, Preferences preferences) {\n\t\tif (path != null) {\n\t\t\t// Do not create the node if it does not exist...\n\t\t\ttry {\n\t\t\t\tif (preferences.nodeExists(path)) {\n\t\t\t\t\treturn preferences.node(path).get(key, null);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch (BackingStoreException ex) {\n\t\t\t\tthrow new BeanDefinitionStoreException(\"Cannot access specified node path [\" + path + \"]\", ex);\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\treturn preferences.get(key, null);\n\t\t}\n\t}\n\n}\n","sourceCodeStart":117,"sourceCodeEnd":144,"githubUrl":"https://github.com/spring-projects/spring-framework/blob/69bf83ad716d0cfc4b0520a19b4d8b24c79d1538/spring-beans/src/main/java/org/springframework/beans/factory/config/PreferencesPlaceholderConfigurer.java#L117-L144","documentation":"Thrown by PreferencesPlaceholderConfigurer.resolvePlaceholder(path, key, preferences) as a BeanDefinitionStoreException when the JDK Preferences API's nodeExists(path) call throws BackingStoreException. PreferencesPlaceholderConfigurer (deprecated since Spring 5.2) resolves ${path/key} placeholders against java.util.prefs.Preferences; a backing-store failure means the OS-level preferences store (registry on Windows, XML files elsewhere) could not be read.","triggerScenarios":"A placeholder containing a '/' such as ${myPath/myKey} with a systemTreePath/userTreePath that points at a preferences node the JVM cannot access. Corrupted or locked preferences backing store. Permissions issues (e.g. writing to systemRoot on a locked-down OS). The preferences store being unavailable in a restricted/sandboxed environment.","commonSituations":"Running in a container or CI where the user/system preferences directory is read-only or absent. Cross-platform differences in Preferences backing store. Using this deprecated configurer after a JDK upgrade that changed prefs behavior.","solutions":["Drop PreferencesPlaceholderConfigurer (deprecated, scheduled for removal in Spring 8.0) and use PropertySourcesPlaceholderConfigurer with a normal properties file or Environment source.","Verify the path exists in the preferences tree and that the JVM has read access to the backing store.","Check the underlying BackingStoreException in the stack trace for the OS-level cause and fix permissions / recreate the preferences node.","Avoid embedding '/' in placeholder keys so no node lookup is performed (root node is used instead)."],"exampleFix":"// before (deprecated, fragile)\nPreferencesPlaceholderConfigurer c = new PreferencesPlaceholderConfigurer();\nc.setSystemTreePath(\"com/example\");\n// after\nPropertySourcesPlaceholderConfigurer c = new PropertySourcesPlaceholderConfigurer();\nc.setLocation(new ClassPathResource(\"application.properties\"));","handlingStrategy":"fallback","validationCode":"// Probe the preferences path before relying on it\ntry {\n    if (!Preferences.userRoot().nodeExists(path)) {\n        // fall back to a properties file or skip\n    }\n} catch (BackingStoreException ignore) {\n    // backing store unavailable - switch configurer\n}","typeGuard":null,"tryCatchPattern":"try {\n    context.refresh();\n} catch (BeanDefinitionStoreException ex) {\n    if (ex.getMessage().contains(\"Cannot access specified node path\")) {\n        // migrate to PropertySourcesPlaceholderConfigurer instead of retrying\n    }\n    throw ex;\n}","preventionTips":["Migrate off PreferencesPlaceholderConfigurer (deprecated since 5.2, removal in 8.0).","Avoid '/' inside placeholder keys so no node lookup occurs.","Ensure the JVM has read/write access to the preferences backing store for the configured tree path.","Prefer environment-variable or properties-file backed configuration in containers/CI."],"tags":["spring","placeholder","preferences","deprecated","io","backing-store"],"backgroundTag":null,"analyzedSha":"69bf83ad716d0cfc4b0520a19b4d8b24c79d1538","analyzedAt":"2026-08-09T15:32:58.770Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}