apache/hadoop · error · IllegalArgumentException

Invalid class specified for {}

Error message

Invalid class specified for {}

What it means

FSEditLog.getJournalClass resolves the JournalManager class for a custom edits URI scheme from the config key dfs.namenode.edits.journal-plugin.<scheme>. Configuration.getClass threw a RuntimeException while loading that value, so the NameNode wraps it in IllegalArgumentException('Invalid class specified for <scheme>'). Typical root causes: ClassNotFoundException (class not on the NameNode classpath), a malformed class name, or a class that does not implement JournalManager.

Source

Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLog.java:1857

    }
  }

  /**
   * Retrieve the implementation class for a Journal scheme.
   * @param conf The configuration to retrieve the information from
   * @param uriScheme The uri scheme to look up.
   * @return the class of the journal implementation
   * @throws IllegalArgumentException if no class is configured for uri
   */
  static Class<? extends JournalManager> getJournalClass(Configuration conf,
                               String uriScheme) {
    String key
      = DFSConfigKeys.DFS_NAMENODE_EDITS_PLUGIN_PREFIX + "." + uriScheme;
    Class <? extends JournalManager> clazz = null;
    try {
      clazz = conf.getClass(key, null, JournalManager.class);
    } catch (RuntimeException re) {
      throw new IllegalArgumentException(
          "Invalid class specified for " + uriScheme, re);
    }
      
    if (clazz == null) {
      LOG.warn("No class configured for " +uriScheme
               + ", " + key + " is empty");
      throw new IllegalArgumentException(
          "No class configured for " + uriScheme);
    }
    return clazz;
  }

  /**
   * Construct a custom journal manager.
   * The class to construct is taken from the configuration.
   * @param uri Uri to construct
   * @return The constructed journal manager
   * @throws IllegalArgumentException if no class is configured for uri

View on GitHub (pinned to 2add963021)

Solutions

  1. Set dfs.namenode.edits.journal-plugin.<scheme> to the exact fully-qualified name of a class implementing org.apache.hadoop.hdfs.server.namenode.JournalManager
  2. Deploy the plugin JAR to the NameNode classpath (share/hadoop/hdfs/lib or HADOOP_CLASSPATH) on every NameNode and JournalNode host
  3. Remove the custom-scheme URI from dfs.namenode.edits.dir / dfs.namenode.shared.edits.dir if the plugin is no longer used
  4. Recompile the plugin against the JournalManager interface of the running Hadoop version

Example fix

<!-- before -->
<property><name>dfs.namenode.edits.journal-plugin.myj</name><value>com.example.MyJournalMgr</value></property>
<!-- ClassNotFoundException: com.example.MyJournalMgr -->

<!-- after: correct FQCN and JAR in share/hadoop/hdfs/lib -->
<property><name>dfs.namenode.edits.journal-plugin.myj</name><value>com.example.storage.MyJournalManager</value></property>
Defensive patterns

Strategy: validation

Validate before calling

// fail fast before NameNode start: every journal-plugin value must load
for (Map.Entry<String,String> e : conf.getValByRegex(
        "^dfs\\.namenode\\.edits\\.journal-plugin\\.").entrySet()) {
  Class<?> c = Class.forName(e.getValue());   // ClassNotFoundException -> fix classpath or name
  if (!org.apache.hadoop.hdfs.server.namenode.JournalManager.class
      .isAssignableFrom(c)) {
    throw new IllegalStateException(
        e.getValue() + " does not implement JournalManager (key " + e.getKey() + ")");
  }
}

Try / catch

try {
  // NameNode / FSEditLog construction
} catch (IllegalArgumentException e) {
  Throwable c = e.getCause();
  while (c != null && !(c.getCause() instanceof ClassNotFoundException)) c = c.getCause();
  if (c != null) {
    // plugin class missing from classpath: fix dfs.namenode.edits.journal-plugin.<scheme>
  }
  throw e;
}

Prevention

When it happens

Trigger: Constructing FSEditLog (NameNode startup) when dfs.namenode.edits.dir or dfs.namenode.shared.edits.dir contains a URI scheme without a built-in handler (not file or qjm) and the matching dfs.namenode.edits.journal-plugin.<scheme> value cannot be loaded as a JournalManager. Thrown from FSEditLog.createJournal at FSEditLog.java:1878.

Common situations: Custom third-party journal manager JAR missing from share/hadoop/hdfs/lib or HADOOP_CLASSPATH; typo in the fully-qualified class name in hdfs-site.xml; plugin compiled against a Hadoop version where it no longer implements JournalManager; stale config entry referencing a deleted plugin class.

Related errors


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