flowable/flowable-engine · error · ActivitiException
Exception while invoking '%s' on class %s
Error message
Exception while invoking '%s' on class %s
What it means
Thrown when the setter invoked via reflection to apply a BPMN field injection raised an InvocationTargetException, i.e. the delegate's own setter method threw an exception internally. The engine rewraps it as an ActivitiException naming the field and target class.
Source
Thrown at modules/flowable5-engine/src/main/java/org/activiti/engine/impl/bpmn/helper/ClassDelegateUtil.java:60
for (FieldDeclaration declaration : fieldDeclarations) {
applyFieldDeclaration(declaration, target);
}
}
}
public static void applyFieldDeclaration(FieldDeclaration declaration, Object target) {
Method setterMethod = ReflectUtil.getSetter(declaration.getName(),
target.getClass(), declaration.getValue().getClass());
if (setterMethod != null) {
try {
setterMethod.invoke(target, declaration.getValue());
} catch (IllegalArgumentException e) {
throw new ActivitiException("Error while invoking '" + declaration.getName() + "' on class " + target.getClass().getName(), e);
} catch (IllegalAccessException e) {
throw new ActivitiException("Illegal access when calling '" + declaration.getName() + "' on class " + target.getClass().getName(), e);
} catch (InvocationTargetException e) {
throw new ActivitiException("Exception while invoking '" + declaration.getName() + "' on class " + target.getClass().getName(), e);
}
} else {
Field field = ReflectUtil.getField(declaration.getName(), target);
if (field == null) {
throw new ActivitiIllegalArgumentException("Field definition uses unexisting field '" + declaration.getName() + "' on class " + target.getClass().getName());
}
// Check if the delegate field's type is correct
if (!fieldTypeCompatible(declaration, field)) {
throw new ActivitiIllegalArgumentException("Incompatible type set on field declaration '" + declaration.getName()
+ "' for class " + target.getClass().getName()
+ ". Declared value has type " + declaration.getValue().getClass().getName()
+ ", while expecting " + field.getType().getName());
}
ReflectUtil.setField(field, target, declaration.getValue());
}
}
public static boolean fieldTypeCompatible(FieldDeclaration declaration, Field field) {View on GitHub (pinned to d6d39ce1c6)
Solutions
- Inspect the cause stack trace: the real error is inside your delegate's setter
- Fix the exception thrown inside the setter (e.g. handle the injected value safely)
- Add null/format validation inside the setter before processing the value
- If the setter must not fail at injection time, defer the logic to the execute() method
Example fix
// before
public void setTimeout(String timeout) {
this.timeout = Integer.parseInt(timeout); // throws on non-numeric
}
// after
public void setTimeout(String timeout) {
this.timeout = timeout != null ? Integer.parseInt(timeout) : 0;
} Defensive patterns
Strategy: try-catch
Try / catch
try {
applyFieldDeclaration(declaration, target);
} catch (org.activiti.engine.ActivitiException e) {
logger.error("Field injection failed on {}", declaration.getName(), e.getCause());
throw e;
} Prevention
- Never throw from delegate setters during injection; validate lazily in execute()
- Unit test delegates with their BPMN field declarations
- Log and inspect the cause chain — the root exception is inside your setter
When it happens
Trigger: The setter method for an injected flowable:field executes and throws any runtime exception (e.g. parsing an invalid literal, NPE on an assumed dependency) during ClassDelegateUtil.applyFieldDeclaration.
Common situations: Setters that validate/transform the injected value and throw on bad input; setters that depend on state not yet initialized at delegate instantiation; type conversion mistakes inside the setter.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- Illegal access when calling '%s' on class %s
- Field definition uses non-existent field '${name}' of class
- Incompatible type set on field declaration '${name}' for cla
- Could not set field ${field}
- Illegal access when calling '<fieldName>' on class <classNam
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/09867ec67b3eb5a6.
Report an issue: GitHub.