flowable/flowable-engine · error · IllegalArgumentException

@ManagedAttribute can only be used on Java bean methods, was

Error message

@ManagedAttribute can only be used on Java bean methods, was: ${method} on bean: ${managedClass}

What it means

MBeanInfoAssembler processes methods annotated with @ManagedAttribute and requires them to be valid Java bean accessors: a getter (isX/getX) or a setter (setX). When an annotated method is neither, it throws IllegalArgumentException naming the offending method and the managed class.

Source

Thrown at modules/flowable-jmx/src/main/java/org/flowable/management/jmx/MBeanInfoAssembler.java:187

                continue;
            }

            LOGGER.trace("Extracting attributes and operations from method: {}", method);
            ManagedAttribute ma = method.getAnnotation(ManagedAttribute.class);
            if (ma != null) {
                String key;
                String desc = ma.description();
                Method getter = null;
                Method setter = null;

                if (ReflectUtil.isGetter(method)) {
                    key = ReflectUtil.getGetterShorthandName(method);
                    getter = method;
                } else if (ReflectUtil.isSetter(method)) {
                    key = ReflectUtil.getSetterShorthandName(method);
                    setter = method;
                } else {
                    throw new IllegalArgumentException("@ManagedAttribute can only be used on Java bean methods, was: " + method + " on bean: " + managedClass);
                }

                // they key must be capitalized
                key = capitalize(key);

                // lookup first
                ManagedAttributeInfo info = attributes.get(key);
                if (info == null) {
                    info = new ManagedAttributeInfo(key, desc);
                }
                if (getter != null) {
                    info.setGetter(getter);
                }
                if (setter != null) {
                    info.setSetter(setter);
                }

                attributes.put(key, info);

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Rename the annotated method to follow bean conventions (getX/isX for getters, setX for setters)
  2. Ensure the getter has no parameters and a non-void return; ensure the setter takes exactly one parameter
  3. Remove @ManagedAttribute from methods that are not bean properties and use @ManagedOperation instead if applicable
  4. Check ReflectUtil.isGetter/isSetter expectations if using non-standard accessors

Example fix

// before
@ManagedAttribute
currentValue(Long v) { this.v = v; } // not a bean method
// after
@ManagedAttribute
public void setCurrentValue(Long v) { this.v = v; }
Defensive patterns

Strategy: validation

Validate before calling

boolean isBeanAccessor(Method m) {
    String n = m.getName();
    boolean getter = (n.startsWith("get") && m.getParameterCount() == 0 && m.getReturnType() != void.class)
        || (n.startsWith("is") && m.getParameterCount() == 0 && (m.getReturnType() == boolean.class || m.getReturnType() == Boolean.class));
    boolean setter = n.startsWith("set") && m.getParameterCount() == 1 && (m.getReturnType() == void.class || m.getReturnType() == m.getDeclaringClass());
    return getter || setter;
}
// apply before annotating/processing: if (!isBeanAccessor(method)) throw ...

Prevention

When it happens

Trigger: Annotating a method with @ManagedAttribute when it has a non-bean signature (wrong parameter/return shape, name not matching get/is/set conventions) so ReflectUtil.isGetter/isSetter both return false.

Common situations: Typos in accessor names (e.g. fetchValue instead of getValue); getters with parameters; setters with no parameter or non-void return; annotating utility methods by mistake when exposing Flowable services via JMX.

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


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/e9d8c93324f235a1. Report an issue: GitHub.