apache/cassandra · error · org.apache.cassandra.config.YAMLException

Unable to find getter for property '%s' on class %s

Error message

Unable to find getter for property '%s' on class %s

What it means

The same property accessor throws YAMLException when invoking the read method fails with IllegalAccessException — i.e. the getter exists but is not accessible to the loader (non-public or restricted). The message wraps the original exception as the cause.

Source

Thrown at src/java/org/apache/cassandra/config/DefaultLoader.java:112

        public MethodPropertyPlus(PropertyDescriptor property)
        {
            super(property);
            this.readMethod = property.getReadMethod();
        }

        @Override
        public Object get(Object object)
        {
            if (!isReadable())
                throw new YAMLException("No readable property '" + getName() + "' on class: " + object.getClass().getName());

            try
            {
                return readMethod.invoke(object);
            }
            catch (IllegalAccessException e)
            {
                throw new YAMLException("Unable to find getter for property '" + getName() + "' on class " + object.getClass().getName(), e);
            }
            catch (InvocationTargetException e)
            {
                throw new YAMLException("Failed calling getter for property '" + getName() + "' on class " + object.getClass().getName(), e.getCause());
            }
        }
    }
}

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Make the property's getter public on the config class.
  2. Ensure the config class and its getters are in an open/exported package for reflective access.
  3. Rebuild/redeploy the unmodified upstream Config class instead of a locally patched one.

Example fix

// before
Object getValue() { return value; }
// after
public Object getValue() { return value; }
Defensive patterns

Strategy: try-catch

Validate before calling

// check Modifier.isPublic(targetClass.getMethod("get" + cap(prop)).getModifiers()) before loading

Type guard

null

Try / catch

try { loader.load(yamlStream); } catch (YAMLException e) { log.error("inaccessible getter while loading config", e.getCause()); }

Prevention

When it happens

Trigger: Reading a cassandra.yaml-backed config property whose getter method is not public or is inaccessible under the active classloader/security manager during DefaultLoader property resolution.

Common situations: Custom or patched Config classes with package-private getters; module/JPMS restrictions hiding the getter; shaded/relocated classes breaking reflective access.

Related errors


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/08cf1ba9a03f018d. Report an issue: GitHub.