{"record":{"id":"56ee803978df080e","repo":"apache/cassandra","slug":"unable-to-create-instance-of-iauditlogger","errorCode":null,"errorMessage":"Unable to create instance of IAuditLogger.","messagePattern":"Unable to create instance of IAuditLogger\\.","errorType":"exception","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/utils/FBUtilities.java","lineNumber":698,"sourceCode":"            return new LocalPartitioner(comparator.get());\n        }\n        return FBUtilities.instanceOrConstruct(partitionerClassName, \"partitioner\", IPartitioner.class);\n    }\n\n    public static IAuditLogger newAuditLogger(String className, Map<String, String> parameters) throws ConfigurationException\n    {\n        if (!className.contains(\".\"))\n            className = \"org.apache.cassandra.audit.\" + className;\n\n        try\n        {\n            Class<? extends IAuditLogger> auditLoggerClass =\n                FBUtilities.classForNameWithoutInitialization(className, \"Audit logger\", IAuditLogger.class);\n            return auditLoggerClass.getConstructor(Map.class).newInstance(parameters);\n        }\n        catch (Exception ex)\n        {\n            throw new ConfigurationException(\"Unable to create instance of IAuditLogger.\", ex);\n        }\n    }\n\n    public static ISslContextFactory newSslContextFactory(String className, Map<String,Object> parameters) throws ConfigurationException\n    {\n        if (!className.contains(\".\"))\n            className = \"org.apache.cassandra.security.\" + className;\n\n        try\n        {\n            Class<? extends ISslContextFactory> sslContextFactoryClass =\n                FBUtilities.classForNameWithoutInitialization(className, \"ISslContextFactory\", ISslContextFactory.class);\n            return sslContextFactoryClass.getConstructor(Map.class).newInstance(parameters);\n        }\n        catch (Exception ex)\n        {\n            // Surface the underlying load failure (e.g. ClassNotFoundException) as the direct cause rather than the\n            // intermediate ConfigurationException that reports it.","sourceCodeStart":680,"sourceCodeEnd":716,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/utils/FBUtilities.java#L680-L716","documentation":"newAuditLogger instantiates the configured IAuditLogger implementation reflectively from its class name plus a Map of parameters. Any failure to load, access, or construct the class is wrapped in a ConfigurationException. This runs at audit-logging startup, so it blocks node start when audit logging is enabled with a bad class.","triggerScenarios":"audit_logging_options with a logger_class that does not exist, lacks a (Map) constructor, has wrong visibility, or whose constructor throws; called from AuditLogManager when initializing audit logging.","commonSituations":"Typo in the fully-qualified class name; custom audit logger jar missing from lib/; constructor signature changed after an upgrade; custom logger throws in its constructor due to bad parameters.","solutions":["Fix logger_class to the correct fully-qualified class name (default: org.apache.cassandra.audit.AuditLogger)","Ensure the class's jar is on the classpath (lib/) on every node","Verify the class has a public constructor accepting Map<String,String>","Check logger constructor/parameters for errors in the server log (root cause is chained as the exception cause)"],"exampleFix":"// before (cassandra.yaml)\naudit_logging_options:\n  logger_class: com.mycompany.MyAuditLoggr\n// after\naudit_logging_options:\n  logger_class: com.mycompany.MyAuditLogger","handlingStrategy":"validation","validationCode":"String cls = auditOptions.get(\"logger_class\");\ntry { Class.forName(cls).getConstructor(Map.class); }\ncatch (ClassNotFoundException | NoSuchMethodException e) { throw new IllegalArgumentException(\"Bad IAuditLogger class: \" + cls, e); }","typeGuard":"boolean isValidAuditLogger(String cn) {\n    try { return IAuditLogger.class.isAssignableFrom(Class.forName(cn)); }\n    catch (Throwable t) { return false; }\n}","tryCatchPattern":"try {\n    AuditLogManager.instance.initialize();\n} catch (ConfigurationException e) {\n    logger.error(\"Audit logger setup failed\", e); // falls back / aborts start with clear cause\n}","preventionTips":["Keep the default AuditLogger class unless a custom one is truly needed","Ship custom logger jars to lib/ on every node in the ring","Test cassandra.yaml changes in a staging node first","Keep a public (Map<String,String>) constructor on custom loggers"],"tags":["config","audit","reflection","classpath"],"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"}