{"record":{"id":"56331372533bb98b","repo":"flowable/flowable-engine","slug":"error-while-invoking-name-on-class-target-g","errorCode":null,"errorMessage":"Error while invoking '${name}' on class ${target.getClass().getName()}","messagePattern":"Error while invoking '(.+?)' on class (.+?)","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/util/ReflectUtil.java","lineNumber":254,"sourceCode":"            for (Method method : methods) {\n                if (method.getName().equals(setterName)) {\n                    Class<?>[] paramTypes = method.getParameterTypes();\n                    if (paramTypes != null && paramTypes.length == 1 && paramTypes[0].isAssignableFrom(fieldType)) {\n                        return method;\n                    }\n                }\n            }\n            return null;\n        } catch (SecurityException e) {\n            throw new FlowableException(\"Not allowed to access method \" + setterName + \" on class \" + clazz.getCanonicalName(), e);\n        }\n    }\n    \n    public static void invokeSetter(Method setterMethod, Object target, String name, Object value) {\n        try {\n            setterMethod.invoke(target, value);\n        } catch (IllegalArgumentException e) {\n            throw new FlowableException(\"Error while invoking '\" + name + \"' on class \" + target.getClass().getName(), e);\n        } catch (IllegalAccessException e) {\n            throw new FlowableException(\"Illegal access when calling '\" + name + \"' on class \" + target.getClass().getName(), e);\n        } catch (InvocationTargetException e) {\n            throw new FlowableException(\"Exception while invoking '\" + name + \"' on class \" + target.getClass().getName(), e);\n        }\n    }\n\n    private static Method findMethod(Class<? extends Object> clazz, String methodName, Object[] args) {\n        for (Method method : clazz.getDeclaredMethods()) {\n            // TODO add parameter matching\n            if (method.getName().equals(methodName) && matches(method.getParameterTypes(), args)) {\n                return method;\n            }\n        }\n        Class<?> superClass = clazz.getSuperclass();\n        if (superClass != null) {\n            return findMethod(superClass, methodName, args);\n        }","sourceCodeStart":236,"sourceCodeEnd":272,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/util/ReflectUtil.java#L236-L272","documentation":"Flowable wraps an IllegalArgumentException thrown when reflectively invoking a setter method via Method.invoke(). It means the supplied value's type is not compatible with the setter's declared parameter type, or the number of arguments is wrong. Flowable rethrows it as a FlowableException naming the property and target class.","triggerScenarios":"ReflectUtil.invokeSetter is called (typically via invokeSetterOrField during engine configuration bean injection) with a value whose runtime type cannot be assigned to the setter's parameter (e.g. passing a String where an int is expected).","commonSituations":"Misconfigured XML/config properties where a property value string cannot be coerced to the bean setter's type; version changes that altered a setter's parameter type; passing null or wrong-typed values into reflective bean population.","solutions":["Check the exception's cause chain for the IllegalArgumentException message naming the expected argument type","Fix the configured value type so it matches the setter parameter (e.g. use \"true\"/\"false\" strings for booleans, numeric strings for ints)","Verify the target class's setter signature matches what the caller passes","If caused by a Flowable version upgrade, check the migration notes for changed setter signatures"],"exampleFix":"// before\nengineConfig.getBeanValue(\"historyLevel\").setValue(\"AUDIT\") // AuditHistoryLevel object passed where String expected\n// after\nengineConfig.getBeanValue(\"historyLevel\").setValue(\"audit\") // correct type for the setter","handlingStrategy":"try-catch","validationCode":"Method m = target.getClass().getMethod(\"setHistoryLevel\", String.class);\nif (!m.getParameterTypes()[0].isInstance(value)) throw new IllegalStateException(\"value type mismatch for setter\");","typeGuard":"boolean isAssignable(Object value, Method setter) {\n    return value == null || !setter.getParameterTypes()[0].isPrimitive() &&\n        setter.getParameterTypes()[0].isInstance(value);\n}","tryCatchPattern":"try {\n    ReflectUtil.invokeSetter(setter, target, name, value);\n} catch (FlowableException e) {\n    logger.error(\"Setter invocation failed for \" + name, e.getCause());\n}","preventionTips":["Match configured property value types to setter parameter types","Check setter signatures after upgrading Flowable","Keep bean setters public with simple, validated types"],"tags":["reflection","bean-injection","type-mismatch"],"backgroundTag":"type-mismatch","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}