quarkusio/quarkus · error · IllegalArgumentException

No getter corresponding to " + methodInfo.declaringClass().n

Error message

No getter corresponding to " + methodInfo.declaringClass().name() + "#" + methodInfo.name() + " found

What it means

BeanParamParser.getGetterMethod throws this when building a REST Client @BeanParam: it cannot find a getter method on the parameter class that matches the annotated field. RESTEasy Reactive's client processor needs a getter/setter pair to populate bean param properties at request build time; a field with @QueryParam/@PathParam etc. but no matching getXxx()/isXxx() method cannot be wired.

Source

Thrown at independent-projects/resteasy-reactive/client/processor/src/main/java/org/jboss/resteasy/reactive/client/processor/beanparam/BeanParamParser.java:271

        if (annotation == null || annotation.value() == null)
            return null;
        return annotation.value().asString();
    }

    private static MethodInfo getGetterMethod(ClassInfo beanParamClass, MethodInfo methodInfo) {
        MethodInfo getter = null;
        if (methodInfo.parametersCount() > 0) { // should be setter
            // find the corresponding getter:
            String setterName = methodInfo.name();
            if (setterName.startsWith("set")) {
                getter = beanParamClass.method(setterName.replace("^set", "^get"));
            }
        } else if (methodInfo.name().startsWith("get")) {
            getter = methodInfo;
        }

        if (getter == null) {
            throw new IllegalArgumentException(
                    "No getter corresponding to " + methodInfo.declaringClass().name() + "#" + methodInfo.name() + " found");
        }
        return getter;
    }

    private static <T extends Item> List<T> paramItemsForFieldsAndMethods(ClassInfo beanParamClass, DotName parameterType,
            BiFunction<String, FieldInfo, T> fieldExtractor, BiFunction<String, MethodInfo, T> methodExtractor) {
        return ParamTypeAnnotations.of(beanParamClass, parameterType).itemsForFieldsAndMethods(fieldExtractor, methodExtractor);
    }

    private BeanParamParser() {
    }

    private static class ParamTypeAnnotations {
        private final ClassInfo beanParamClass;
        private final List<AnnotationInstance> annotations;

        private ParamTypeAnnotations(ClassInfo beanParamClass, DotName parameterType) {

View on GitHub (pinned to e1c734241f)

Solutions

  1. Add a standard getter for each annotated field (getName() or isName() for booleans).
  2. Rename the field/method so the getter follows the get/is prefix convention matching the field name.
  3. If using fluent accessors, add conventional getters alongside them, or use public setter+getter pairs.
  4. Verify the class is not a Java record; records are not supported as BeanParam with this parser — convert to a plain class with getters/setters.

Example fix

// before
class MyParams {
  @QueryParam("q")
  String query;
  String query() { return query; } // fluent, not a getter
}
// after
class MyParams {
  @QueryParam("q")
  String query;
  public String getQuery() { return query; }
  public void setQuery(String q) { this.query = q; }
}
Defensive patterns

Strategy: validation

Validate before calling

// Build-time check: every annotated field in a @BeanParam class must have a getter
for (Field f : beanParamClass.getDeclaredFields()) {
  if (f.isAnnotationPresent(QueryParam.class) || f.isAnnotationPresent(HeaderParam.class)) {
    String g = "get" + Character.toUpperCase(f.getName().charAt(0)) + f.getName().substring(1);
    boolean hasGetter = false;
    for (Method m : beanParamClass.getMethods()) {
      if (m.getName().equals(g) || (m.getName().equals("is" + g.substring(3)) && (m.getReturnType() == boolean.class))) { hasGetter = true; break; }
    }
    if (!hasGetter) throw new IllegalStateException(f.getName() + " has no getter");
  }
}

Prevention

When it happens

Trigger: Using a @BeanParam class in a REST Client interface where a field carries a REST parameter annotation (@QueryParam, @HeaderParam, @PathParam, @CookieParam) but has no corresponding getter (getXxx, isXxx for booleans) or the method name doesn't start with get/is.

Common situations: Refactoring a DTO and renaming a getter without renaming the field; using record-style or fluent (chained, non-get-prefixed) accessors; Kotlin `val` properties compiled without standard bean getters in some setups; copying server-side resource classes (where fields suffice) into client code.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/5ef2e8aad168a633. Report an issue: GitHub.