apache/cassandra · error · ConfigurationException

Unable to create an instance of crypto provider for

Error message

Unable to create an instance of crypto provider for %s

What it means

newCryptoProvider instantiates the configured AbstractCryptoProvider implementation for JCE provider setup. Failures to load or construct the class are wrapped in a ConfigurationException unless already one. This occurs at startup when crypto provider configuration (custom provider class) is present.

Solutions

  1. Fix the crypto provider class name in configuration
  2. Ensure the provider implementation is on the classpath
  3. Verify it extends AbstractCryptoProvider and has the required public constructor
  4. Fix constructor-level issues reported in the chained cause (e.g. keystore path/password)
Defensive patterns

Strategy: validation

Validate before calling

try { Class<?> c = Class.forName(className, false, getClass().getClassLoader());
      if (!AbstractCryptoProvider.class.isAssignableFrom(c)) throw new IllegalArgumentException("not an AbstractCryptoProvider: " + className); }
catch (ClassNotFoundException e) { throw new IllegalArgumentException("crypto provider class not found", e); }

Try / catch

try {
    provider = FBUtilities.newCryptoProvider(className, params);
} catch (ConfigurationException e) {
    logger.error("crypto provider init failed for " + className, e);
    throw e;
}

Prevention

When it happens

Trigger: crypto_provider configuration naming a class that is missing, not an AbstractCryptoProvider subclass, lacks the expected constructor, or whose constructor throws during initialization.

Common situations: Typo in provider class name; custom provider jar missing; provider constructor throws because keystore parameters are wrong; version drift changed the AbstractCryptoProvider contract.

Related errors


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

Appendix: source

Thrown at src/java/org/apache/cassandra/utils/FBUtilities.java:739

    public static AbstractCryptoProvider newCryptoProvider(String className, Map<String, String> parameters) throws ConfigurationException
    {
        try
        {
            if (!className.contains("."))
                className = "org.apache.cassandra.security." + className;

            Class<? extends AbstractCryptoProvider> cryptoProviderClass =
                FBUtilities.classForNameWithoutInitialization(className, "crypto provider class", AbstractCryptoProvider.class);
            return cryptoProviderClass.getConstructor(Map.class).newInstance(Collections.unmodifiableMap(parameters));
        }
        catch (Exception e)
        {
            // no need to wrap it in another ConfgurationException if FBUtilities.classForName might throw it
            if (e instanceof ConfigurationException)
                throw (ConfigurationException) e;
            else
                throw new ConfigurationException(String.format("Unable to create an instance of crypto provider for %s", className), e);
        }
    }

    public static AbstractCompressionProvider newCompressionProvider(String className) throws ConfigurationException
    {
        try
        {
            if (!className.contains("."))
                className = "org.apache.cassandra.io.compress." + className;

            Class<? extends AbstractCompressionProvider> compressionProviderClass =
                FBUtilities.classForNameWithoutInitialization(className, "compression service provider", AbstractCompressionProvider.class);
            return compressionProviderClass.getConstructor().newInstance();
        }
        catch (ConfigurationException e)
        {
            throw e;
        }

View on GitHub (pinned to 88fd0f6a0e)