flowable/flowable-engine · error · org.flowable.common.engine.api.FlowableException
can't clear configuration beans
Error message
can't clear configuration beans
What it means
clear() is unsupported on SpringBeanFactoryProxyMap because the map is a live view over the Spring BeanFactory; beans are managed by Spring and cannot be removed through this facade. The method throws unconditionally.
Source
Thrown at modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/cfg/SpringBeanFactoryProxyMap.java:60
@Override
public boolean containsKey(Object key) {
if ((key == null) || !String.class.isAssignableFrom(key.getClass())) {
return false;
}
return beanFactory.containsBean((String) key);
}
@Override
public Set<Object> keySet() {
throw new FlowableException("unsupported operation on configuration beans");
// List<String> beanNames =
// Arrays.asList(beanFactory.getBeanDefinitionNames());
// return new HashSet<Object>(beanNames);
}
@Override
public void clear() {
throw new FlowableException("can't clear configuration beans");
}
@Override
public boolean containsValue(Object value) {
throw new FlowableException("can't search values in configuration beans");
}
@Override
public Set<Map.Entry<Object, Object>> entrySet() {
throw new FlowableException("unsupported operation on configuration beans");
}
@Override
public boolean isEmpty() {
throw new FlowableException("unsupported operation on configuration beans");
}
@OverrideView on GitHub (pinned to d6d39ce1c6)
Solutions
- Do not call clear() on this map; it is backed by the Spring context and cleared by closing the ApplicationContext
- Remove only application-level beans via Spring lifecycle (destroy beans or refresh the context), not via this Map API
- If mutable behavior is required, wrap or replace the map with a plain HashMap populated with the beans you control
Example fix
// before configBeans.clear(); // after // let Spring manage lifecycle: applicationContext.close(); // or context.refresh()
Defensive patterns
Strategy: type-guard
Validate before calling
if (map instanceof SpringBeanFactoryProxyMap) {
throw new IllegalStateException("use ApplicationContext lifecycle to clear beans");
} Type guard
boolean isMutableMap(Map<?,?> m) { return !(m instanceof SpringBeanFactoryProxyMap); } Try / catch
try {
map.clear();
} catch (FlowableException e) {
// fall back to Spring lifecycle
applicationContext.close();
} Prevention
- Never treat the bean map as a mutable cache
- Let Spring own bean lifecycle (close/refresh the context)
- If mutation is needed, use a real Map such as ProcessEngineConfiguration.getBeans()
When it happens
Trigger: Calling clear() directly on the map, or indirectly via Map.clear() invoked by framework cleanup code (e.g. context shutdown helpers, cache eviction, or code treating the map as a mutable cache).
Common situations: Code that clears shared configuration maps on restart/reload, generic map-reset logic in tests, or libraries that accept a Map and clear it before repopulating.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- unsupported operation on configuration beans
- can't search values in configuration beans
- unsupported operation on configuration beans
- can't clear configuration beans
- can't search values in configuration beans
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/831e2d8b8a203585.
Report an issue: GitHub.