{"record":{"id":"deda07b162f3fd66","repo":"Netflix/Hystrix","slug":"classsimplename-implementation-not-able-to-be-a","errorCode":null,"errorMessage":"${classSimpleName} implementation not able to be accessed: ${implementingClass}","messagePattern":"(.+?) implementation not able to be accessed: (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"hystrix-core/src/main/java/com/netflix/hystrix/strategy/HystrixPlugins.java","lineNumber":358,"sourceCode":"    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());\n            return hp;\n        }","sourceCodeStart":340,"sourceCodeEnd":376,"githubUrl":"https://github.com/Netflix/Hystrix/blob/5ce3bc58c38e7ca60ef2fe0e516e390e294ad941/hystrix-core/src/main/java/com/netflix/hystrix/strategy/HystrixPlugins.java#L340-L376","documentation":"Plugin classes supplied through hystrix.plugin.<PluginSimpleName>.implementation are instantiated with Class.newInstance(), which enforces Java access rules: the class and its no-arg constructor must be public. IllegalAccessException is caught and rethrown as this RuntimeException naming the configured class.","triggerScenarios":"The strategy class is package-private; the no-arg constructor is private or protected (e.g. a singleton pattern with a private constructor); a non-public class in a different package than Hystrix.","commonSituations":"Applying the 'private constructor + getInstance()' singleton idiom to a Hystrix strategy; strategies written as package-private helpers; Java 9+ modules that do not export the strategy's package.","solutions":["Make the strategy class public and give it a public no-arg constructor.","If you must keep a singleton, keep getInstance() but leave the no-arg constructor public as well.","For JPMS deployments, ensure the strategy's package is exported to the module loading Hystrix."],"exampleFix":"// before\nclass MyStrategy extends HystrixMetricsPublisher { // package-private\n    private MyStrategy() {}\n}\n\n// after\npublic class MyStrategy extends HystrixMetricsPublisher {\n    public MyStrategy() {}\n}","handlingStrategy":"validation","validationCode":"Constructor<?> ctor = Class.forName(fqcn).getConstructor(); // must exist\nif (!Modifier.isPublic(ctor.getModifiers()) || !Modifier.isPublic(cls.getModifiers())) {\n    throw new IllegalStateException(\"Plugin class/constructor must be public: \" + fqcn);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Do not apply private-constructor singletons to classes configured via hystrix.plugin properties.","Keep plugin classes public, top-level or static-nested, with public no-arg constructors."],"tags":["hystrix","configuration","reflection","access-modifiers"],"backgroundTag":null,"analyzedSha":"5ce3bc58c38e7ca60ef2fe0e516e390e294ad941","analyzedAt":"2026-08-14T10:55:35.600Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}