apache/cassandra · error · ConfigurationException
Cannot access method create in %s
Error message
Cannot access method create in %s
What it means
Method.invoke on the compressor's create(Map) threw IllegalAccessException: the method exists but is not accessible from DefaultCompressionProvider (e.g. it is non-public, or its declaring class is not accessible). This is wrapped as a ConfigurationException naming the class whose create method could not be accessed.
Source
Thrown at src/java/org/apache/cassandra/io/compress/DefaultCompressionProvider.java:84
Method method = compressorClass.getMethod("create", Map.class);
ICompressor compressor = (ICompressor)method.invoke(null, compressionOptions);
// Check for unknown options
for (String provided : compressionOptions.keySet())
if (!compressor.supportedOptions().contains(provided))
throw new ConfigurationException("Unknown compression options " + provided);
return compressor;
}
catch (NoSuchMethodException e)
{
throw new ConfigurationException("create method not found", e);
}
catch (SecurityException e)
{
throw new ConfigurationException("Access forbidden", e);
}
catch (IllegalAccessException e)
{
throw new ConfigurationException("Cannot access method create in " + compressorClass.getName(), e);
}
catch (InvocationTargetException e)
{
if (e.getTargetException() instanceof ConfigurationException)
throw (ConfigurationException) e.getTargetException();
Throwable cause = e.getCause() == null
? e
: e.getCause();
throw new ConfigurationException(format("%s.create() threw an error: %s %s",
compressorClass.getSimpleName(),
cause.getClass().getName(),
cause.getMessage()),
e);
}
catch (ExceptionInInitializerError e)
{View on GitHub (pinned to 88fd0f6a0e)
Solutions
- Make the create(Map) method (and its declaring class) public static.
- Call method.setAccessible(true) in a custom provider if you control the code path and policy permits it.
- Move the compressor class to a public top-level class in its own file or an exported package.
Example fix
// before
class MyCompressor implements ICompressor { static MyCompressor create(Map<String,String> o) {...} }
// after
public class MyCompressor implements ICompressor { public static ICompressor create(Map<String,String> o) {...} } Defensive patterns
Strategy: validation
Validate before calling
Method m;
try { m = compressorClass.getMethod("create", Map.class); }
catch (NoSuchMethodException e) { throw new IllegalStateException("no create"); }
if (!Modifier.isPublic(m.getModifiers()) || !Modifier.isPublic(compressorClass.getModifiers()))
throw new IllegalStateException("create and its declaring class must be public"); Type guard
boolean isPubliclyAccessible(Class<?> c) {
try { return Modifier.isPublic(c.getMethod("create", Map.class).getModifiers()) && Modifier.isPublic(c.getModifiers()); }
catch (NoSuchMethodException e) { return false; }
} Try / catch
try {
registry.getCompressor(cls, opts);
} catch (ConfigurationException e) {
if (e.getMessage().startsWith("Cannot access method create")) log.error("Make {}.create(Map) public", cls);
throw e;
} Prevention
- Declare both the compressor class and its create(Map) method public
- Avoid nested/package-private compressor classes
- Run checkstyle/reflection tests that verify factory accessibility
- Keep custom compressors as public top-level classes
When it happens
Trigger: createCompressor() targeting a class whose create(Map) method is package-private/protected/private, or whose declaring class is non-public so even a public method is unreachable reflectively without setAccessible.
Common situations: Custom compressor implementations with non-public factory methods; nesting a compressor class inside another class without making it public; obfuscated/minified builds that strip public modifiers; package-private compressor classes in third-party jars.
Understand the failure class
Background: Permission denied / not authorized / 403 Forbidden: access-control rejections when the caller lacks the required role, grant, or ownership — this error's family across 18 libraries.
Related errors
- create method not found
- Access forbidden
- %s.create() threw an error: %s %s
- Unable to create an instance of the compression service prov
- Failed to instantiate %s
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/e30253ec9a80ed77.
Report an issue: GitHub.