theonedev/onedev · error · RuntimeException
Getter not found (class: %s, property: %s)
Error message
Getter not found (class: %s, property: %s)
What it means
BeanUtils.getGetter() resolves a JavaBean getter method for a property by walking the class hierarchy via findGetter(). If no getter exists for the given property name, it throws a RuntimeException naming the class and property. This is a programming/reflection error — code referenced a bean property that does not exist.
Source
Thrown at server-core/src/main/java/io/onedev/server/util/BeanUtils.java:168
}
/**
* Find getter method by property name in specified class and super classes.
*
* @param clazz
* class to search getter method. All super classes will also be
* searched if not found in current class
* @param propertyName
* name of the property to search getter for
* @return
* getter method
* @throws
* RuntimeException if not found in class hierarchy
*/
public static Method getGetter(Class<?> clazz, String propertyName) {
Method getter = findGetter(clazz, propertyName);
if (getter == null) {
throw new RuntimeException(String.format("Getter not found (class: %s, property: %s)", clazz.getName(), propertyName));
}
return getter;
}
/**
* Find getter method by property name in specified class and super classes.
*
* @param clazz
* class to search getter method. All super classes will also be
* searched if not found in current class
* @param propertyName
* name of the property to search getter for
* @return
* getter method, or <tt>null</tt> if not found in class hierarchy
*/
public static Method findGetter(Class<?> clazz, String propertyName) {
String methodSuffix = getAccessorSuffix(propertyName);
Method getter = ReflectionUtils.findMethod(clazz, "get" + methodSuffix);View on GitHub (pinned to d44925c47c)
Solutions
- Check the exact property name and its capitalization against the bean class; add or fix the getter (getX()/isX())
- Update all string references after refactoring — search the codebase for the old property name
- Compile-time safety: prefer method references/constant property names over raw strings where possible
- At runtime, validate property existence reflectively before use and fail fast with a clear message
Example fix
// before Method m = BeanUtils.getGetter(PullRequest.class, "tilte"); // typo // after Method m = BeanUtils.getGetter(PullRequest.class, "title"); // matches getTitle()
Defensive patterns
Strategy: validation
Validate before calling
public static boolean hasGetter(Class<?> clazz, String prop) {
String cap = Character.toUpperCase(prop.charAt(0)) + prop.substring(1);
try {
clazz.getMethod("get" + cap);
return true;
} catch (NoSuchMethodException e) {
try { clazz.getMethod("is" + cap); return true; }
catch (NoSuchMethodException e2) { return false; }
}
} Type guard
if (hasGetter(PullRequest.class, "title")) {
Method m = BeanUtils.getGetter(PullRequest.class, "title");
} Try / catch
try {
Method m = BeanUtils.getGetter(clazz, property);
} catch (RuntimeException e) {
if (e.getMessage().startsWith("Getter not found"))
throw new ConfigurationException("Check property name against " + clazz.getName(), e);
throw e;
} Prevention
- Search for usages of a property string before renaming the field
- Keep getter names strictly JavaBean-compliant
- Prefer compile-checked property references over raw strings
When it happens
Trigger: Calling BeanUtils.getGetter(clazz, propertyName) where the class (and its superclasses) define no method matching the JavaBean getter convention for that property (missing getX()/isX(), wrong case, or property renamed).
Common situations: Renaming a bean field without updating string-based property references (query criteria, Wicket property models, YAML/setting keys); typos in property names; passing an interface/class different from the actual bean type.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- Not recognized getter method (class: %s, method: %s)
- Cannot find setter (class: %s, property: %s, type: %s)
- Invalid element type:
- No property found with name: ${propertyNameOrDisplayName}
- Getter not found for property: ${propertyName}
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/e2b2706e7b6bc368.
Report an issue: GitHub.