{"record":{"id":"6cce7e9ec7425874","repo":"flowable/flowable-engine","slug":"exception-while-invoking-name-on-class-targ","errorCode":null,"errorMessage":"Exception while invoking '${name}' on class ${target.getClass().getName()}","messagePattern":"Exception 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":258,"sourceCode":"                        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        }\n        return null;\n    }\n\n    public static Object instantiate(String className, Object[] args) {","sourceCodeStart":240,"sourceCodeEnd":276,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/util/ReflectUtil.java#L240-L276","documentation":"Flowable wraps an InvocationTargetException thrown when the setter method itself threw an exception during execution. The original exception is the cause; Flowable only reports that invoking '<name>' on the target class failed.","triggerScenarios":"invokeSetter calls a setter whose body throws (e.g. validation inside the setter fails, NPE inside setter logic) during reflective bean population.","commonSituations":"Setters that validate configuration values and throw on invalid input; setters depending on uninitialized state; upgraded library setters that changed behavior.","solutions":["Inspect the cause chain (InvocationTargetException.getCause()) to find the real exception thrown by the setter","Fix the value being set so the setter's validation succeeds","Debug the setter body for the failing logic","Check library changelog if the setter is from a dependency that changed requirements"],"exampleFix":"// before\nconfig.setProperty(\"historyLevel\", \"INVALID\"); // setter throws for unknown level\n// after\nconfig.setProperty(\"historyLevel\", \"audit\");","handlingStrategy":"try-catch","validationCode":"// validate the value against the setter's expectations before invoking, e.g.\nif (value == null && setter.getParameterTypes()[0].isPrimitive()) throw new IllegalArgumentException(\"null for primitive setter\");","typeGuard":null,"tryCatchPattern":"try {\n    ReflectUtil.invokeSetter(setter, target, name, value);\n} catch (FlowableException e) {\n    Throwable cause = e.getCause();\n    logger.error(\"Setter \" + name + \" threw \" + cause.getClass().getName(), cause);\n}","preventionTips":["Always inspect getCause() — the real failure is inside the setter","Validate values before injecting them into configured beans","Keep setter bodies exception-free for simple config values"],"tags":["reflection","invocation-target","bean-injection"],"backgroundTag":"invalid-argument-value","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"}