spring-projects/spring-framework · error · BeanDefinitionStoreException
Cannot access specified node path [
Error message
Cannot access specified node path [
What it means
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.
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).
Example fix
// before (deprecated, fragile)
PreferencesPlaceholderConfigurer c = new PreferencesPlaceholderConfigurer();
c.setSystemTreePath("com/example");
// after
PropertySourcesPlaceholderConfigurer c = new PropertySourcesPlaceholderConfigurer();
c.setLocation(new ClassPathResource("application.properties")); Defensive patterns
Strategy: fallback
Validate before calling
// Probe the preferences path before relying on it
try {
if (!Preferences.userRoot().nodeExists(path)) {
// fall back to a properties file or skip
}
} catch (BackingStoreException ignore) {
// backing store unavailable - switch configurer
} Try / catch
try {
context.refresh();
} catch (BeanDefinitionStoreException ex) {
if (ex.getMessage().contains("Cannot access specified node path")) {
// migrate to PropertySourcesPlaceholderConfigurer instead of retrying
}
throw ex;
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Could not load properties
- Error registering bean definition
- No StringValueResolver specified - pass a resolver object…
- Argument type mismatch: expected '
- Cannot apply @Lookup to beans without corresponding bean…
AI-assisted analysis of spring-projects/spring-framework@69bf83ad71 (2026-08-09).
Data as JSON: /api/errors/7766293616c4c746.
Report an issue: GitHub.
Appendix: source
Thrown at spring-beans/src/main/java/org/springframework/beans/factory/config/PreferencesPlaceholderConfigurer.java:135
* Resolve the given path and key against the given Preferences.
* @param path the preferences path (placeholder part before '/')
* @param key the preferences key (placeholder part after '/')
* @param preferences the Preferences to resolve against
* @return the value for the placeholder, or {@code null} if none found
*/
protected @Nullable String resolvePlaceholder(@Nullable String path, String key, Preferences preferences) {
if (path != null) {
// Do not create the node if it does not exist...
try {
if (preferences.nodeExists(path)) {
return preferences.node(path).get(key, null);
}
else {
return null;
}
}
catch (BackingStoreException ex) {
throw new BeanDefinitionStoreException("Cannot access specified node path [" + path + "]", ex);
}
}
else {
return preferences.get(key, null);
}
}
}
View on GitHub (pinned to 69bf83ad71)