apache/hadoop · error · IOException

Failed to instantiate class {auditClassname} defined in {key

Error message

Failed to instantiate class {auditClassname} defined in {key}: {e}

What it means

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.

Source

Thrown at hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/audit/AuditIntegration.java:119

      Configuration conf,
      String key,
      OperationAuditorOptions options) throws IOException {
    final Class<? extends OperationAuditor> auditClassname
        = conf.getClass(
        key,
        LoggingAuditor.class,
        OperationAuditor.class);
    try {
      LOG.debug("Auditor class is {}", auditClassname);
      final Constructor<? extends OperationAuditor> constructor
          = auditClassname.getConstructor();
      final OperationAuditor instance = constructor.newInstance();
      instance.init(options);
      return instance;
    } catch (NoSuchMethodException | InstantiationException
        | RuntimeException
        | IllegalAccessException | InvocationTargetException e) {
      throw new IOException("Failed to instantiate class "
          + auditClassname
          + " defined in " + key
          + ": " + e,
          e);
    }
  }

  /**
   * Get the span from the execution attributes.
   * @param executionAttributes the execution attributes
   * @return the span callbacks or null
   */
  public static AuditSpanS3A
      retrieveAttachedSpan(final ExecutionAttributes executionAttributes) {
    return executionAttributes.getAttribute(AUDIT_SPAN_EXECUTION_ATTRIBUTE);
  }

  /**

View on GitHub (pinned to 2add963021)

Solutions

  1. Read the chained cause in the message - it names the real failure (constructor missing, access, or the exception init() threw)
  2. Give the auditor a public no-arg constructor and make the class public and concrete
  3. Validate init options (writable paths, numeric thresholds) with production configuration
  4. Temporarily unset fs.s3a.audit.request.auditor (falls back to LoggingAuditor) to confirm the rest of the config works

Example fix

// before: auditor lacks a no-arg constructor
public class MyAuditor implements OperationAuditor {
  public MyAuditor(String logPath) { ... } // NoSuchMethodException at init
}

// after: no-arg constructor, setup moves to init()
public class MyAuditor implements OperationAuditor {
  public MyAuditor() { }
  @Override public void init(S3AAuditOptions options) {
    // resolve paths/options here; throw early with a clear message
  }
}
Defensive patterns

Strategy: validation

Validate before calling

Class<?> clazz = Class.forName(conf.get("fs.s3a.audit.request.auditor",
    "org.apache.hadoop.fs.s3a.audit.impl.LoggingAuditor"));
clazz.getConstructor(); // throws NoSuchMethodException if no public no-arg ctor

Try / catch

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

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/0e25284de5d80ae3. Report an issue: GitHub.