juicedata/juicefs · error · IOException

incompatible hadoop version

Error message

incompatible hadoop version

What it means

When the Hadoop distribution exposes ACL methods, the client looks up the 14-argument FileStatus constructor introduced in newer Hadoop versions. If reflection cannot find it, the installed Hadoop version is too old/incompatible for the ACL code path, so initialization aborts with this IOException.

Source

Thrown at sdk/java/src/main/java/io/juicefs/JuiceFileSystemImpl.java:551

      withStreamCapability = false;
    }
    if (withStreamCapability) {
      try {
        constructor = Class.forName("io.juicefs.JuiceFileSystemImpl$BufferedFSOutputStreamWithStreamCapabilities")
                .getConstructor(OutputStream.class, Integer.TYPE, String.class);
      } catch (ClassNotFoundException | NoSuchMethodException e) {
        throw new RuntimeException(e);
      }
    }
    // for hadoop compatibility
    boolean hasAclMtd = ReflectionUtil.hasMethod(FileStatus.class.getName(), "hasAcl", (String[]) null);
    if (hasAclMtd) {
      fileStatusConstructor = ReflectionUtil.getConstructor(FileStatus.class,
          long.class, boolean.class, int.class, long.class, long.class,
          long.class, FsPermission.class, String.class, String.class, Path.class,
          Path.class, boolean.class, boolean.class, boolean.class);
      if (fileStatusConstructor == null) {
        throw new IOException("incompatible hadoop version");
      }
    }

    String umaskStr = getConf(conf, "umask", null);
    if (!isEmpty(umaskStr)) {
      conf.set("fs.permissions.umask-mode", umaskStr);
      LOG.debug("override fs.permissions.umask-mode to {}", umaskStr);
    }
    uMask = FsPermission.getUMask(conf);

    hflushMethod = getConf(conf, "hflush", "writeback");
    initializeStorageIds(conf);

    if ("true".equalsIgnoreCase(getConf(conf, "enable-metrics", "false"))) {
      metricsEnable = true;
      JuiceFSInstrumentation.init(this, statistics);
    }

View on GitHub (pinned to c9a67b23e8)

Solutions

  1. Upgrade the cluster to Hadoop 2.7+ (the 14-arg FileStatus constructor exists from 2.x onward).
  2. Check classpath ordering: 'hadoop classpath' and ensure no old hadoop-common jar shadows the current one.
  3. If ACLs are not needed, run a JuiceFS client build/setting that does not enable the ACL path (update the client version).
  4. Align the juicefs-hadoop jar version with the cluster's Hadoop major version.

Example fix

// before (Hadoop 2.2 classpath)
FileStatus(long,boolean,int,long,long,FsPermission,...) // 14-arg ctor missing -> IOException
// after
# set HADOOP_USER_CLASSPATH to a hadoop-common >= 2.7, or upgrade the cluster
hadoop version  # confirm 2.7+
Defensive patterns

Strategy: validation

Validate before calling

boolean hasCtor;
try {
  org.apache.hadoop.fs.FileStatus.class.getConstructor(long.class, boolean.class, int.class,
    long.class, long.class, long.class, org.apache.hadoop.fs.permission.FsPermission.class,
    String.class, String.class, org.apache.hadoop.fs.Path.class, org.apache.hadoop.fs.Path.class,
    boolean.class, boolean.class, boolean.class);
  hasCtor = true;
} catch (NoSuchMethodException e) { hasCtor = false; }
if (!hasCtor) throw new IllegalStateException("Hadoop too old for JuiceFS ACL support: " + org.apache.hadoop.util.VersionInfo.getVersion());

Try / catch

try { fs = FileSystem.get(uri, conf); } catch (IOException e) { if (e.getMessage().equals("incompatible hadoop version")) { /* upgrade hadoop-common or drop old jars from classpath */ } throw e; }

Prevention

When it happens

Trigger: initialize() on a Hadoop version whose org.apache.hadoop.fs.FileStatus lacks the (short,boolean,int,long,long,long,FsPermission,String,String,Path,Path,boolean,boolean,boolean) constructor while hasAclMtd is true.

Common situations: Running the JuiceFS jar on Hadoop 1.x or very old 2.x; a vendor shim/uber-jar shading an old FileStatus first on the classpath; mixing jars from different Hadoop versions in the classpath.

Related errors


AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06). Data as JSON: /api/errors/64a9908af2c7b828. Report an issue: GitHub.