{"record":{"id":"f21d9d489caac22e","repo":"Netflix/Hystrix","slug":"classsimplename-implementation-not-able-to-be-i","errorCode":null,"errorMessage":"${classSimpleName} implementation not able to be instantiated: ${implementingClass}","messagePattern":"(.+?) implementation not able to be instantiated: (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"hystrix-core/src/main/java/com/netflix/hystrix/strategy/HystrixPlugins.java","lineNumber":356,"sourceCode":"    \n    @SuppressWarnings(\"unchecked\")\n    private static <T> T getPluginImplementationViaProperties(Class<T> pluginClass, HystrixDynamicProperties dynamicProperties) {\n        String classSimpleName = pluginClass.getSimpleName();\n        // Check Archaius for plugin class.\n        String propertyName = \"hystrix.plugin.\" + classSimpleName + \".implementation\";\n        String implementingClass = dynamicProperties.getString(propertyName, null).get();\n        if (implementingClass != null) {\n            try {\n                Class<?> cls = Class.forName(implementingClass);\n                // narrow the scope (cast) to the type we're expecting\n                cls = cls.asSubclass(pluginClass);\n                return (T) cls.newInstance();\n            } catch (ClassCastException e) {\n                throw new RuntimeException(classSimpleName + \" implementation is not an instance of \" + classSimpleName + \": \" + implementingClass);\n            } catch (ClassNotFoundException e) {\n                throw new RuntimeException(classSimpleName + \" implementation class not found: \" + implementingClass, e);\n            } catch (InstantiationException e) {\n                throw new RuntimeException(classSimpleName + \" implementation not able to be instantiated: \" + implementingClass, e);\n            } catch (IllegalAccessException e) {\n                throw new RuntimeException(classSimpleName + \" implementation not able to be accessed: \" + implementingClass, e);\n            }\n        } else {\n            return null;\n        }\n    }\n    \n    \n\n    private static HystrixDynamicProperties resolveDynamicProperties(ClassLoader classLoader, LoggerSupplier logSupplier) {\n        HystrixDynamicProperties hp = getPluginImplementationViaProperties(HystrixDynamicProperties.class, \n                HystrixDynamicPropertiesSystemProperties.getInstance());\n        if (hp != null) {\n            logSupplier.getLogger().debug(\n                    \"Created HystrixDynamicProperties instance from System property named \"\n                    + \"\\\"hystrix.plugin.HystrixDynamicProperties.implementation\\\". Using class: {}\", \n                    hp.getClass().getCanonicalName());","sourceCodeStart":338,"sourceCodeEnd":374,"githubUrl":"https://github.com/Netflix/Hystrix/blob/5ce3bc58c38e7ca60ef2fe0e516e390e294ad941/hystrix-core/src/main/java/com/netflix/hystrix/strategy/HystrixPlugins.java#L338-L374","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Add a public no-argument constructor to the strategy class.","If the class is abstract, configure a concrete subclass instead.","Move the class to a top-level or static nested class if it is a non-static inner class."],"exampleFix":"// before\npublic class MyStrategy extends HystrixPropertiesStrategy {\n    public MyStrategy(Config cfg) { ... } // no no-arg ctor -> InstantiationException\n}\n\n// after\npublic class MyStrategy extends HystrixPropertiesStrategy {\n    public MyStrategy() { this(defaultConfig()); }\n    public MyStrategy(Config cfg) { ... }\n}","handlingStrategy":"validation","validationCode":"Class<?> cls = Class.forName(fqcn);\nint modifiers = cls.getModifiers();\nif (Modifier.isAbstract(modifiers) || cls.isInterface()) {\n    throw new IllegalStateException(\"Configured plugin is abstract/interface: \" + fqcn);\n}\ncls.getConstructor(); // NoSuchMethodException if no no-arg ctor","typeGuard":null,"tryCatchPattern":"try {\n    pluginClass.getDeclaredConstructor().newInstance();\n} catch (ReflectiveOperationException e) {\n    // surface as configuration error naming the property and class\n}","preventionTips":["Always give strategy classes a public no-arg constructor.","Add an ArchUnit/reflection test asserting configured plugin classes are concrete and instantiable."],"tags":["hystrix","configuration","reflection","constructor"],"backgroundTag":null,"analyzedSha":"5ce3bc58c38e7ca60ef2fe0e516e390e294ad941","analyzedAt":"2026-08-14T10:55:35.600Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}