apache/cassandra · error · ConfigurationException
create method not found
Error message
create method not found
What it means
DefaultCompressionProvider creates compressors reflectively via a public static create(Map) method on the compressor class. If getMethod("create", Map.class) finds no such method, the provider cannot construct the compressor and throws this ConfigurationException with the NoSuchMethodException attached.
Source
Thrown at src/java/org/apache/cassandra/io/compress/DefaultCompressionProvider.java:76
* @throws ConfigurationException if the compressor class does not have a valid create method,
* if there are unknown compression options, or if the compressor creation fails
*/
@Override
public ICompressor createCompressor(Class<?> compressorClass, Map<String, String> compressionOptions) throws IllegalStateException
{
try
{
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();
View on GitHub (pinned to 88fd0f6a0e)
Solutions
- Add or expose a public static create(Map<String,String>) method on the compressor class that builds and returns an ICompressor.
- Verify the class name resolves to the intended ICompressor implementation, not a helper or similarly named class.
- Use a built-in compressor class (LZ4Compressor, SnappyCompressor, DeflateCompressor) which all provide create(Map).
- If using a custom provider, implement createCompressor() to construct the compressor directly instead of relying on reflection.
Example fix
// before
public static MyCompressor create(Map<String,String> options, int extra) { ... }
// after
public static ICompressor create(Map<String,String> options) { ... } Defensive patterns
Strategy: validation
Validate before calling
try {
Method m = compressorClass.getMethod("create", Map.class);
if (!ICompressor.class.isAssignableFrom(m.getReturnType())) throw new IllegalArgumentException("create does not return ICompressor");
} catch (NoSuchMethodException e) {
throw new IllegalArgumentException(compressorClass + " lacks public static create(Map)");
} Type guard
boolean hasCreateMethod(Class<?> c) {
try { c.getMethod("create", Map.class); return true; } catch (NoSuchMethodException e) { return false; }
} Try / catch
try {
registry.getCompressor(customCompressorClass, opts);
} catch (ConfigurationException e) {
if (e.getMessage().equals("create method not found")) log.error("Add public static create(Map<String,String>) to {}", customCompressorClass);
throw e;
} Prevention
- Ensure every custom compressor exposes public static ICompressor create(Map<String,String>)
- Smoke-test Class.forName + getMethod("create", Map.class) on custom compressor classes before deployment
- Prefer built-in compressor classes when no custom behavior is needed
- Pin the Cassandra version and verify factory signatures match it
When it happens
Trigger: createCompressor() called with a compressorClass that has no public static ICompressor create(Map<String,String>) method — e.g. a custom or third-party class passed to getCompressor(), or a built-in class whose signature differs across versions.
Common situations: Pointing sstable_compression at a custom ICompressor implementation that only has instance factory methods or a constructor; class name typos resolving to a helper class instead of the compressor; running an older Cassandra where the create(Map) signature differs.
Related errors
- Unknown compression
- Access forbidden
- Cannot access method create in %s
- %s.create() threw an error: %s %s
- Could not create Compression for type
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/76e4a0961dcaa267.
Report an issue: GitHub.