{"record":{"id":"afb3ec566a0ea4eb","repo":"flowable/flowable-engine","slug":"unsupported-operation-on-configuration-beans-afb3ec","errorCode":null,"errorMessage":"unsupported operation on configuration beans","messagePattern":"unsupported operation on configuration beans","errorType":"exception","errorClass":"ActivitiException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/cfg/SpringBeanFactoryProxyMap.java","lineNumber":52,"sourceCode":"    @Override\n    public Object get(Object key) {\n        if ((key == null) || (!String.class.isAssignableFrom(key.getClass()))) {\n            return null;\n        }\n        return beanFactory.getBean((String) key);\n    }\n\n    @Override\n    public boolean containsKey(Object key) {\n        if ((key == null) || (!String.class.isAssignableFrom(key.getClass()))) {\n            return false;\n        }\n        return beanFactory.containsBean((String) key);\n    }\n\n    @Override\n    public Set<Object> keySet() {\n        throw new ActivitiException(\"unsupported operation on configuration beans\");\n        // List<String> beanNames = Arrays.asList(beanFactory.getBeanDefinitionNames());\n        // return new HashSet<Object>(beanNames);\n    }\n\n    @Override\n    public void clear() {\n        throw new ActivitiException(\"can't clear configuration beans\");\n    }\n\n    @Override\n    public boolean containsValue(Object value) {\n        throw new ActivitiException(\"can't search values in configuration beans\");\n    }\n\n    @Override\n    public Set<Map.Entry<Object, Object>> entrySet() {\n        throw new ActivitiException(\"unsupported operation on configuration beans\");\n    }","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/cfg/SpringBeanFactoryProxyMap.java#L34-L70","documentation":"SpringBeanFactoryProxyMap is a read-only Map view over a Spring BeanFactory used by the legacy Activiti engine to resolve beans by name. Mutating or enumerating Map methods that the bean factory cannot meaningfully support are deliberately unimplemented and throw ActivitiException. keySet() is one of these unsupported methods.","triggerScenarios":"Calling keySet() on a SpringBeanFactoryProxyMap instance, e.g. iterating the map's keys, copying it into another Map, or framework code that enumerates map keys (logging, serialization, copy constructors).","commonSituations":"Debug code printing the whole map; passing the map to utilities like Collections.copy or Jackson serialization that call keySet(); trying to copy beans from the map during a migration.","solutions":["Do not enumerate the map; look up beans directly with get(key) or containsKey(key)","Use beanFactory.getBeanDefinitionNames() on the underlying ListableBeanFactory to list bean names instead","Wrap only if you need iteration: build your own map from getBeanDefinitionNames() and getBean(name)","Remove code paths (loggers/serializers) that treat this map as a full Map"],"exampleFix":"// before\nfor (Object key : springBeanFactoryProxyMap.keySet()) { ... }\n// after\nfor (String name : ((ListableBeanFactory) beanFactory).getBeanDefinitionNames()) {\n    Object bean = springBeanFactoryProxyMap.get(name);\n}","handlingStrategy":"try-catch","validationCode":"if (map instanceof SpringBeanFactoryProxyMap) {\n    // do not enumerate keys; resolve names via ListableBeanFactory.getBeanDefinitionNames()\n}","typeGuard":"boolean isReadOnlyBeanMap = (map instanceof SpringBeanFactoryProxyMap);","tryCatchPattern":"try {\n    Set<Object> keys = map.keySet();\n} catch (ActivitiException e) {\n    // fall back to beanFactory.getBeanDefinitionNames()\n}","preventionTips":["Treat SpringBeanFactoryProxyMap as lookup-only: use get/containsKey, never enumeration","Exclude it from generic logging, serialization, and map-copy utilities","When you need the bean list, query ListableBeanFactory.getBeanDefinitionNames() directly"],"tags":["spring","unsupported-operation","map"],"backgroundTag":"unsupported-operation","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}