首页 > 代码库 > Hive启动报找不到hadoop版本问题

Hive启动报找不到hadoop版本问题

bin/hive 提示"xxx Illegal Hadoop Version: Unknown (expected A.B.* format)"类似这样的问题,

经过查看代码

 public static String getMajorVersion() {    String vers = VersionInfo.getVersion();    String[] parts = vers.split("\\.");    if (parts.length < 2) {      throw new RuntimeException("Illegal Hadoop Version: " + vers +          " (expected A.B.* format)");    }    String majorVersion = parts[0] + "." + parts[1];    // If we are running a security release, we won‘t have UnixUserGroupInformation    // (removed by HADOOP-6299 when switching to JAAS for Login)    try {      Class.forName("org.apache.hadoop.security.UnixUserGroupInformation");    } catch (ClassNotFoundException cnf) {      if ("0.20".equals(majorVersion)) {        majorVersion += "S";      }    }    return majorVersion;  }

String vers = VersionInfo.getVersion();这里没有取到值。

查看"import org.apache.hadoop.util.VersionInfo;"

得知,这里引用是的hadoop的包,于是将hadoop-core.jar包导入Lib目录,问题解决!