Netflix/Hystrix · error · RuntimeException

${classSimpleName} implementation not able to be instantiate

Error message

${classSimpleName} implementation not able to be instantiated: ${implementingClass}

What it means

After loading a plugin class named by hystrix.plugin.<PluginSimpleName>.implementation, Hystrix instantiates it with Class.newInstance(), which requires a public no-arg constructor and a concrete class. InstantiationException (abstract class, interface, or no default constructor) is rethrown as this RuntimeException.

Source

Thrown at hystrix-core/src/main/java/com/netflix/hystrix/strategy/HystrixPlugins.java:356

    
    @SuppressWarnings("unchecked")
    private static <T> T getPluginImplementationViaProperties(Class<T> pluginClass, HystrixDynamicProperties dynamicProperties) {
        String classSimpleName = pluginClass.getSimpleName();
        // Check Archaius for plugin class.
        String propertyName = "hystrix.plugin." + classSimpleName + ".implementation";
        String implementingClass = dynamicProperties.getString(propertyName, null).get();
        if (implementingClass != null) {
            try {
                Class<?> cls = Class.forName(implementingClass);
                // narrow the scope (cast) to the type we're expecting
                cls = cls.asSubclass(pluginClass);
                return (T) cls.newInstance();
            } catch (ClassCastException e) {
                throw new RuntimeException(classSimpleName + " implementation is not an instance of " + classSimpleName + ": " + implementingClass);
            } catch (ClassNotFoundException e) {
                throw new RuntimeException(classSimpleName + " implementation class not found: " + implementingClass, e);
            } catch (InstantiationException e) {
                throw new RuntimeException(classSimpleName + " implementation not able to be instantiated: " + implementingClass, e);
            } catch (IllegalAccessException e) {
                throw new RuntimeException(classSimpleName + " implementation not able to be accessed: " + implementingClass, e);
            }
        } else {
            return null;
        }
    }
    
    

    private static HystrixDynamicProperties resolveDynamicProperties(ClassLoader classLoader, LoggerSupplier logSupplier) {
        HystrixDynamicProperties hp = getPluginImplementationViaProperties(HystrixDynamicProperties.class, 
                HystrixDynamicPropertiesSystemProperties.getInstance());
        if (hp != null) {
            logSupplier.getLogger().debug(
                    "Created HystrixDynamicProperties instance from System property named "
                    + "\"hystrix.plugin.HystrixDynamicProperties.implementation\". Using class: {}", 
                    hp.getClass().getCanonicalName());

View on GitHub (pinned to 5ce3bc58c3)

Solutions

  1. Add a public no-argument constructor to the strategy class.
  2. If the class is abstract, configure a concrete subclass instead.
  3. Move the class to a top-level or static nested class if it is a non-static inner class.

Example fix

// before
public class MyStrategy extends HystrixPropertiesStrategy {
    public MyStrategy(Config cfg) { ... } // no no-arg ctor -> InstantiationException
}

// after
public class MyStrategy extends HystrixPropertiesStrategy {
    public MyStrategy() { this(defaultConfig()); }
    public MyStrategy(Config cfg) { ... }
}
Defensive patterns

Strategy: validation

Validate before calling

Class<?> cls = Class.forName(fqcn);
int modifiers = cls.getModifiers();
if (Modifier.isAbstract(modifiers) || cls.isInterface()) {
    throw new IllegalStateException("Configured plugin is abstract/interface: " + fqcn);
}
cls.getConstructor(); // NoSuchMethodException if no no-arg ctor

Try / catch

try {
    pluginClass.getDeclaredConstructor().newInstance();
} catch (ReflectiveOperationException e) {
    // surface as configuration error naming the property and class
}

Prevention

When it happens

Trigger: The configured class is abstract or an interface; the class has only constructors with arguments and no public no-arg constructor; the class is a non-static inner class whose implicit constructor needs an outer instance.

Common situations: Registering an abstract base strategy 'for convenience'; a strategy whose constructor takes configuration parameters with no nullary overload; Kotlin/Scala strategy classes whose primary constructor has parameters and no @JvmOverloads no-arg variant.

Related errors


AI-assisted analysis of Netflix/Hystrix@5ce3bc58c3 (2026-08-14). Data as JSON: /api/errors/f21d9d489caac22e. Report an issue: GitHub.