4
  • Hive 3.1.2
  • Hadoop 3.2.1

When I run hive in command line, it tell me the error message below:

which: no hbase in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin)
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/hadoop/apache-hive-3.1.2-bin/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/hadoop/hadoop3/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
Exception in thread "main" java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;Ljava/lang/Object;)V
        at org.apache.hadoop.conf.Configuration.set(Configuration.java:1357)
        at org.apache.hadoop.conf.Configuration.set(Configuration.java:1338)
        at org.apache.hadoop.mapred.JobConf.setJar(JobConf.java:536)
        at org.apache.hadoop.mapred.JobConf.setJarByClass(JobConf.java:554)
        at org.apache.hadoop.mapred.JobConf.<init>(JobConf.java:448)
        at org.apache.hadoop.hive.conf.HiveConf.initialize(HiveConf.java:5141)
        at org.apache.hadoop.hive.conf.HiveConf.<init>(HiveConf.java:5099)
        at org.apache.hadoop.hive.common.LogUtils.initHiveLog4jCommon(LogUtils.java:97)
        at org.apache.hadoop.hive.common.LogUtils.initHiveLog4j(LogUtils.java:81)
        at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:699)
        at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:683)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.hadoop.util.RunJar.run(RunJar.java:323)
        at org.apache.hadoop.util.RunJar.main(RunJar.java:236)

What should I do?

Journeyman Geek
  • 133,878

2 Answers2

3

It looks like this was triggered by Hadoop updating its Guava dependency in mid-2019: HADOOP-15960. That change went out in 3.0.4, 3.1.3, and 3.2.1.

Hive ships its own incompatible version of Guava, not only in lib/guava-*.jar, but also within lib/hive-exec-*.jar, which repackages a ton of external libraries. Because Hive doesn't work without hive-exec, we can't just remove it and get the Guava JAR from Hadoop.

hive-exec's "fat jar" format has been causing problems since at least 2011, but so far they haven't done much about it:

They finally merged in a change to shade Guava (but not the other libraries?) in hive-exec as of HIVE-22126, but the fix version on that is 4.0.0, which isn't released yet.

At this point, it looks like our options are either:

  • Use Hadoop 3.0.3, 3.2.0, or 3.1.2, the last releases before HADOOP-15960. But note that the previous Guava version has a known vulnerability: CVE-2018-10237.
  • Build Hive trunk from source.
Tim Yates
  • 146
0

rm /home/hadoop/apache-hive-3.1.2-bin/lib/log4j-slf4j-impl-2.10.0.jar

Because the class conflict removes a thread, but there is another problem. java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava / lang / String; Ljava / lang / Object; )V