{"record":{"id":"1ddee9590bea8062","repo":"apache/cassandra","slug":"unable-to-find-s-class-s","errorCode":null,"errorMessage":"Unable to find %s class '%s'","messagePattern":"Unable to find (.+?) class '(.+?)'","errorType":"exception","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/utils/FBUtilities.java","lineNumber":780,"sourceCode":"    }\n\n    /**\n     * Loads and initializes a class.\n     *\n     * @return The Class for the given name.\n     * @param classname Fully qualified classname.\n     * @param readable Descriptive noun for the role the class plays.\n     * @throws ConfigurationException If the class cannot be found.\n     */\n    public static <T> Class<T> classForName(String classname, String readable) throws ConfigurationException\n    {\n        try\n        {\n            return (Class<T>)Class.forName(classname);\n        }\n        catch (ClassNotFoundException | NoClassDefFoundError e)\n        {\n            throw new ConfigurationException(String.format(\"Unable to find %s class '%s'\", readable, classname), e);\n        }\n    }\n\n    /**\n     * Loads a class without initializing it, then verifies it extends or implements the expected base type.\n     *\n     * @return The Class for the given name.\n     * @param classname Fully qualified classname.\n     * @param readable Descriptive noun for the role the class plays.\n     * @param expectedType Required superclass or interface.\n     * @throws ConfigurationException If the class cannot be found or is not assignable to {@code expectedType}.\n     */\n    public static <T> Class<? extends T> classForNameWithoutInitialization(String classname,\n                                                                           String readable,\n                                                                           Class<T> expectedType) throws ConfigurationException\n    {\n        return classForNameWithoutInitialization(classname, readable, expectedType, FBUtilities.class.getClassLoader());\n    }","sourceCodeStart":762,"sourceCodeEnd":798,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/utils/FBUtilities.java#L762-L798","documentation":"classForName loads and initializes a class by name and verifies nothing; if Class.forName cannot find it (ClassNotFoundException or NoClassDefFoundError), it throws a ConfigurationException identifying the readable description and class name. It is the generic reflective class-loading entry point for pluggable components.","triggerScenarios":"Any configuration-driven class name (seed provider, SSTable format, auth, etc.) passed to FBUtilities.classForName that is not present on the classpath or fails to link.","commonSituations":"Missing dependency jar in lib/; typo in fully-qualified class name; NoClassDefFoundError caused by a transitive dependency failure or version mismatch; shading/renaming after upgrade.","solutions":["Fix the class name in configuration to the correct fully-qualified name","Add the missing jar to lib/ on all nodes and restart","If NoClassDefFoundError, check the chained cause for the real missing class and add that dependency","Ensure jar versions match your Cassandra version"],"exampleFix":"// before (cassandra.yaml)\nseed_provider:\n  - class_name: org.apache.cassandra.locator.SimpleSeedProvide\n// after\nseed_provider:\n  - class_name: org.apache.cassandra.locator.SimpleSeedProvider","handlingStrategy":"validation","validationCode":"boolean classExists(String cn) {\n    try { Class.forName(cn, false, Thread.currentThread().getContextClassLoader()); return true; }\n    catch (Throwable t) { return false; }\n}","typeGuard":null,"tryCatchPattern":"try {\n    Class<?> cls = FBUtilities.classForName(name, readable);\n} catch (ConfigurationException e) {\n    logger.error(\"Cannot load \" + readable + \": \" + name + \" — check classpath/config\", e);\n    throw e;\n}","preventionTips":["Spell-check fully-qualified class names in cassandra.yaml","Deploy all custom jars to lib/ on every node before restart","Watch for NoClassDefFoundError causes indicating missing transitive dependencies","Pin plugin jar versions compatible with your Cassandra release"],"tags":["classpath","reflection","config"],"backgroundTag":"class-not-found","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}