flowable/flowable-engine · error · ActivitiException
can't clear configuration beans
Error message
can't clear configuration beans
What it means
SpringBeanFactoryProxyMap is a read-only view over a Spring BeanFactory; it never holds entries of its own. clear() therefore cannot do anything meaningful and is deliberately unimplemented, throwing ActivitiException.
Source
Thrown at modules/flowable5-engine/src/main/java/org/activiti/engine/impl/cfg/SpringBeanFactoryProxyMap.java:59
@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 ActivitiException("unsupported operation on configuration beans");
// List<String> beanNames = Arrays.asList(beanFactory.getBeanDefinitionNames());
// return new HashSet<Object>(beanNames);
}
@Override
public void clear() {
throw new ActivitiException("can't clear configuration beans");
}
@Override
public boolean containsValue(Object value) {
throw new ActivitiException("can't search values in configuration beans");
}
@Override
public Set<Map.Entry<Object, Object>> entrySet() {
throw new ActivitiException("unsupported operation on configuration beans");
}
@Override
public boolean isEmpty() {
throw new ActivitiException("unsupported operation on configuration beans");
}
@OverrideView on GitHub (pinned to d6d39ce1c6)
Solutions
- Remove the clear() call; the map is a live view of the Spring context and needs no clearing
- To remove a bean, manipulate the Spring context (e.g. beanFactory.removeBeanDefinition if a ConfigurableBeanFactory) rather than the map
- For tests, recreate the ApplicationContext instead of clearing this map
- Wrap the call in an instanceof/check or skip Map instances of this type in generic clearing code
Example fix
// before map.clear(); // after // no-op: SpringBeanFactoryProxyMap is a read-only view; clear the Spring context instead if needed
Defensive patterns
Strategy: try-catch
Validate before calling
if (map instanceof SpringBeanFactoryProxyMap) {
throw new IllegalStateException("read-only bean map: clear() is not supported; manage beans via the Spring context");
} Type guard
boolean isReadOnlyBeanMap = (map instanceof SpringBeanFactoryProxyMap);
Try / catch
try {
map.clear();
} catch (ActivitiException e) {
// map is a read-only view; reset state elsewhere
} Prevention
- Never call mutation methods (clear/put/remove) on SpringBeanFactoryProxyMap
- For resets, recreate the ApplicationContext or manipulate the underlying ConfigurableBeanFactory
- Guard generic map-cleanup utilities against this read-only implementation
When it happens
Trigger: Calling clear() on the map directly, or via code that clears maps generically (cache eviction, test teardown, Map.clear() invoked by framework cleanup).
Common situations: Test cleanup code resetting all maps; a utility that clears any Map it receives; misunderstanding the map as a regular HashMap of configuration beans.
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 clear configuration beans
- can't search values in configuration beans
- unsupported operation on 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/f77315895a0b1903.
Report an issue: GitHub.