{"record":{"id":"64a9908af2c7b828","repo":"juicedata/juicefs","slug":"incompatible-hadoop-version","errorCode":null,"errorMessage":"incompatible hadoop version","messagePattern":"incompatible hadoop version","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"sdk/java/src/main/java/io/juicefs/JuiceFileSystemImpl.java","lineNumber":551,"sourceCode":"      withStreamCapability = false;\n    }\n    if (withStreamCapability) {\n      try {\n        constructor = Class.forName(\"io.juicefs.JuiceFileSystemImpl$BufferedFSOutputStreamWithStreamCapabilities\")\n                .getConstructor(OutputStream.class, Integer.TYPE, String.class);\n      } catch (ClassNotFoundException | NoSuchMethodException e) {\n        throw new RuntimeException(e);\n      }\n    }\n    // for hadoop compatibility\n    boolean hasAclMtd = ReflectionUtil.hasMethod(FileStatus.class.getName(), \"hasAcl\", (String[]) null);\n    if (hasAclMtd) {\n      fileStatusConstructor = ReflectionUtil.getConstructor(FileStatus.class,\n          long.class, boolean.class, int.class, long.class, long.class,\n          long.class, FsPermission.class, String.class, String.class, Path.class,\n          Path.class, boolean.class, boolean.class, boolean.class);\n      if (fileStatusConstructor == null) {\n        throw new IOException(\"incompatible hadoop version\");\n      }\n    }\n\n    String umaskStr = getConf(conf, \"umask\", null);\n    if (!isEmpty(umaskStr)) {\n      conf.set(\"fs.permissions.umask-mode\", umaskStr);\n      LOG.debug(\"override fs.permissions.umask-mode to {}\", umaskStr);\n    }\n    uMask = FsPermission.getUMask(conf);\n\n    hflushMethod = getConf(conf, \"hflush\", \"writeback\");\n    initializeStorageIds(conf);\n\n    if (\"true\".equalsIgnoreCase(getConf(conf, \"enable-metrics\", \"false\"))) {\n      metricsEnable = true;\n      JuiceFSInstrumentation.init(this, statistics);\n    }\n","sourceCodeStart":533,"sourceCodeEnd":569,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/sdk/java/src/main/java/io/juicefs/JuiceFileSystemImpl.java#L533-L569","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Upgrade the cluster to Hadoop 2.7+ (the 14-arg FileStatus constructor exists from 2.x onward).","Check classpath ordering: 'hadoop classpath' and ensure no old hadoop-common jar shadows the current one.","If ACLs are not needed, run a JuiceFS client build/setting that does not enable the ACL path (update the client version).","Align the juicefs-hadoop jar version with the cluster's Hadoop major version."],"exampleFix":"// before (Hadoop 2.2 classpath)\nFileStatus(long,boolean,int,long,long,FsPermission,...) // 14-arg ctor missing -> IOException\n// after\n# set HADOOP_USER_CLASSPATH to a hadoop-common >= 2.7, or upgrade the cluster\nhadoop version  # confirm 2.7+","handlingStrategy":"validation","validationCode":"boolean hasCtor;\ntry {\n  org.apache.hadoop.fs.FileStatus.class.getConstructor(long.class, boolean.class, int.class,\n    long.class, long.class, long.class, org.apache.hadoop.fs.permission.FsPermission.class,\n    String.class, String.class, org.apache.hadoop.fs.Path.class, org.apache.hadoop.fs.Path.class,\n    boolean.class, boolean.class, boolean.class);\n  hasCtor = true;\n} catch (NoSuchMethodException e) { hasCtor = false; }\nif (!hasCtor) throw new IllegalStateException(\"Hadoop too old for JuiceFS ACL support: \" + org.apache.hadoop.util.VersionInfo.getVersion());","typeGuard":null,"tryCatchPattern":"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; }","preventionTips":["Pin cluster Hadoop to 2.7+ where JuiceFS is deployed.","Audit the classpath for multiple hadoop-common versions: 'hadoop classpath | tr ':' '\\n' | grep hadoop-common'.","Test new juicefs-hadoop jars on a staging node with the exact cluster Hadoop version."],"tags":["hadoop","reflection","compatibility"],"backgroundTag":"class-not-found","analyzedSha":"c9a67b23e8e08ec23ec331aa6f1675e2319e921c","analyzedAt":"2026-09-06T17:55:48.476Z","contentChangedAt":"2026-09-06T17:55:48.476Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}