apache/hadoop · critical · RuntimeException

Failed to initialize %s

Error message

Failed to initialize %s

What it means

After KMS instantiates every configured audit logger (KMSAudit.java:160, initializeAuditLoggers), it calls initialize(conf) on each. Any exception thrown by a logger's initialize is wrapped in RuntimeException 'Failed to initialize <logger class name>' and aborts KMS startup. The inner cause carries the real reason, e.g. HdfsKMSAuditLogger failing to acquire the NameNode audit logger.

Source

Thrown at hadoop-common-project/hadoop-kms/src/main/java/org/apache/hadoop/crypto/key/kms/server/KMSAudit.java:160

  /**
   * Create a collection of KMSAuditLoggers from configuration, and initialize
   * them. If any logger failed to be created or initialized, a RunTimeException
   * is thrown.
   */
  private void initializeAuditLoggers(Configuration conf) {
    Set<Class<? extends KMSAuditLogger>> classes = getAuditLoggerClasses(conf);
    Preconditions
        .checkState(!classes.isEmpty(), "Should have at least 1 audit logger.");
    for (Class<? extends KMSAuditLogger> c : classes) {
      final KMSAuditLogger logger = ReflectionUtils.newInstance(c, conf);
      auditLoggers.add(logger);
    }
    for (KMSAuditLogger logger: auditLoggers) {
      try {
        LOG.info("Initializing audit logger {}", logger.getClass());
        logger.initialize(conf);
      } catch (Exception ex) {
        throw new RuntimeException(
            "Failed to initialize " + logger.getClass().getName(), ex);
      }
    }
  }

  private void logEvent(final OpStatus status, AuditEvent event) {
    event.setEndTime(Time.now());
    for (KMSAuditLogger logger: auditLoggers) {
      logger.logAuditEvent(status, event);
    }
  }

  /**
   * Logs to the audit service a single operation on the KMS or on a key.
   *
   * @param opStatus
   *          The outcome of the audited event
   * @param op

View on GitHub (pinned to 2add963021)

Solutions

  1. Read the full stack trace: the caused-by exception names the real failure inside the logger's initialize()
  2. For HdfsKMSAuditLogger, ensure the HDFS audit logger configuration it depends on is present and valid on the KMS host
  3. Add/fix any properties your custom logger requires in kms-site.xml before enabling it
  4. As a stopgap, temporarily remove the failing logger from hadoop.kms.audit.logger to bring KMS back up, fix the cause, then re-enable
Defensive patterns

Strategy: try-catch

Try / catch

// Startup-time failure: read the caused-by of RuntimeException 'Failed to initialize <logger>' and fix the logger's own config before restart

Prevention

When it happens

Trigger: Configuring hadoop.kms.audit.logger with a logger whose initialize() fails: HdfsKMSAuditLogger when the HDFS audit logger cannot be initialized (bad log4j/HDFS audit config), or a custom logger whose constructor/initialize throws for missing settings.

Common situations: Enabling HDFS-based KMS audit logging without the required HDFS audit log4j configuration; custom logger expecting extra properties in kms-site.xml that were not deployed; logger jar present but its runtime dependencies missing; version mismatch between logger implementation and KMS API.

Related errors


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