{"record":{"id":"0e25284de5d80ae3","repo":"apache/hadoop","slug":"failed-to-instantiate-class-auditclassname-defin","errorCode":null,"errorMessage":"Failed to instantiate class {auditClassname} defined in {key}: {e}","messagePattern":"Failed to instantiate class (.+?) defined in (.+?): (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/audit/AuditIntegration.java","lineNumber":119,"sourceCode":"      Configuration conf,\n      String key,\n      OperationAuditorOptions options) throws IOException {\n    final Class<? extends OperationAuditor> auditClassname\n        = conf.getClass(\n        key,\n        LoggingAuditor.class,\n        OperationAuditor.class);\n    try {\n      LOG.debug(\"Auditor class is {}\", auditClassname);\n      final Constructor<? extends OperationAuditor> constructor\n          = auditClassname.getConstructor();\n      final OperationAuditor instance = constructor.newInstance();\n      instance.init(options);\n      return instance;\n    } catch (NoSuchMethodException | InstantiationException\n        | RuntimeException\n        | IllegalAccessException | InvocationTargetException e) {\n      throw new IOException(\"Failed to instantiate class \"\n          + auditClassname\n          + \" defined in \" + key\n          + \": \" + e,\n          e);\n    }\n  }\n\n  /**\n   * Get the span from the execution attributes.\n   * @param executionAttributes the execution attributes\n   * @return the span callbacks or null\n   */\n  public static AuditSpanS3A\n      retrieveAttachedSpan(final ExecutionAttributes executionAttributes) {\n    return executionAttributes.getAttribute(AUDIT_SPAN_EXECUTION_ATTRIBUTE);\n  }\n\n  /**","sourceCodeStart":101,"sourceCodeEnd":137,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/audit/AuditIntegration.java#L101-L137","documentation":"IOException from AuditIntegration when the class named by fs.s3a.audit.request.auditor cannot be instantiated: reflection finds no public no-arg constructor, the class is abstract or non-public, or its init(options) throws. The auditor is created while initializing the S3A filesystem's request-auditing pipeline, so the filesystem fails to come up.","triggerScenarios":"fs.s3a.audit.request.auditor names a class without a public () constructor (NoSuchMethodException), an abstract or inaccessible class (InstantiationException/IllegalAccessException), or one whose init(S3AAuditOptions) throws - for example an unwritable log path or invalid option values.","commonSituations":"Rolling out a custom operation auditor; shading/fat-JAR packaging breaking class accessibility; hadoop-aws upgrades changing auditor option names so init fails; auditing options tuned only on one node group.","solutions":["Read the chained cause in the message - it names the real failure (constructor missing, access, or the exception init() threw)","Give the auditor a public no-arg constructor and make the class public and concrete","Validate init options (writable paths, numeric thresholds) with production configuration","Temporarily unset fs.s3a.audit.request.auditor (falls back to LoggingAuditor) to confirm the rest of the config works"],"exampleFix":"// before: auditor lacks a no-arg constructor\npublic class MyAuditor implements OperationAuditor {\n  public MyAuditor(String logPath) { ... } // NoSuchMethodException at init\n}\n\n// after: no-arg constructor, setup moves to init()\npublic class MyAuditor implements OperationAuditor {\n  public MyAuditor() { }\n  @Override public void init(S3AAuditOptions options) {\n    // resolve paths/options here; throw early with a clear message\n  }\n}","handlingStrategy":"validation","validationCode":"Class<?> clazz = Class.forName(conf.get(\"fs.s3a.audit.request.auditor\",\n    \"org.apache.hadoop.fs.s3a.audit.impl.LoggingAuditor\"));\nclazz.getConstructor(); // throws NoSuchMethodException if no public no-arg ctor","typeGuard":null,"tryCatchPattern":"catch IOException containing 'Failed to instantiate class' during fs initialization; unwrap getCause() to see the real failure (constructor, access, or init options) and fix the class/config - not retryable","preventionTips":["Require public no-arg constructors on plugin classes loaded by Hadoop","Run a config smoke test that instantiates custom auditors at deploy time","Pin plugin JARs on the cluster classpath and re-test after hadoop-aws upgrades"],"tags":["s3a","hadoop-aws","auditing","reflection","configuration","class-loading"],"backgroundTag":"class-instantiation-failed","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}