apache/hadoop · error · IllegalArgumentException

Unable to construct journal, {}

Error message

Unable to construct journal, {}

What it means

FSEditLog.createJournal first looks for the 4-argument constructor (Configuration, URI, NamespaceInfo, String nameServiceId); on NoSuchMethodException it falls back to the legacy 3-argument constructor (Configuration, URI, NamespaceInfo). This catch fires when the fallback also fails: the class implements neither constructor signature, or its 3-arg constructor threw during newInstance. Everything is wrapped in IllegalArgumentException('Unable to construct journal, <uri>') with the real cause chained.

Source

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

  JournalManager createJournal(URI uri) {
    Class<? extends JournalManager> clazz
      = getJournalClass(conf, uri.getScheme());

    try {
      Constructor<? extends JournalManager> cons
        = clazz.getConstructor(Configuration.class, URI.class,
            NamespaceInfo.class, String.class);
      String nameServiceId = conf.get(DFSConfigKeys.DFS_NAMESERVICE_ID);
      return cons.newInstance(conf, uri, storage.getNamespaceInfo(),
          nameServiceId);
    } catch (NoSuchMethodException ne) {
      try {
        Constructor<? extends JournalManager> cons
            = clazz.getConstructor(Configuration.class, URI.class,
            NamespaceInfo.class);
        return cons.newInstance(conf, uri, storage.getNamespaceInfo());
      } catch (Exception e) {
        throw new IllegalArgumentException("Unable to construct journal, "
            + uri, e);
      }
    } catch (Exception e) {
      throw new IllegalArgumentException("Unable to construct journal, "
                                         + uri, e);
    }
  }

  @VisibleForTesting
  // needed by async impl to restart thread when edit log is replaced by a
  // spy because a spy is a shallow copy
  public void restart() {
  }

  /**
   * Return total number of syncs happened on this edit log.
   * @return long - count
   */

View on GitHub (pinned to 2add963021)

Solutions

  1. Give the JournalManager class a public constructor (Configuration, URI, NamespaceInfo, String nameServiceId), the preferred signature, or the legacy (Configuration, URI, NamespaceInfo)
  2. Recompile the plugin against the exact Hadoop version running the NameNode
  3. Read the chained cause in the NameNode log: NoSuchMethodException at the root means signature mismatch; InvocationTargetException means the constructor itself threw

Example fix

// before: only a Configuration-only constructor exists
public MyJournalManager(Configuration conf) { ... }

// after: supported signature resolved by FSEditLog.createJournal
public MyJournalManager(Configuration conf, URI uri,
    NamespaceInfo nsInfo, String nameServiceId) { ... }
Defensive patterns

Strategy: validation

Validate before calling

// deploy-time check: the plugin must expose a supported constructor
Class<?> c = Class.forName(className);
boolean ok = false;
try { c.getConstructor(Configuration.class, URI.class,
    NamespaceInfo.class, String.class); ok = true; } catch (NoSuchMethodException ignore) { }
try { c.getConstructor(Configuration.class, URI.class,
    NamespaceInfo.class); ok = true; } catch (NoSuchMethodException ignore) { }
if (!ok) throw new IllegalStateException(
    className + " has no supported JournalManager constructor");

Try / catch

try {
  // FSEditLog construction with custom journal URIs
} catch (IllegalArgumentException e) {
  Throwable root = e;
  while (root.getCause() != null) root = root.getCause();
  if (root instanceof NoSuchMethodException) {
    // signature mismatch: recompile plugin with a (Configuration, URI,
    // NamespaceInfo[, String]) constructor
  }
  throw e;
}

Prevention

When it happens

Trigger: Deploying a custom JournalManager whose constructors match neither (Configuration, URI, NamespaceInfo, String) nor (Configuration, URI, NamespaceInfo): for example a class built for a Hadoop version with a different factory or constructor contract, or one exposing constructors with extra parameters.

Common situations: Plugin recompiled against Hadoop trunk and deployed on branch-2 (or the reverse); plugin upgraded without changing its constructor; binary copied between clusters running different Hadoop lines.

Related errors


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