- 蜂巢 3.1.2
- Hadoop 3.2.1
当我在命令行中运行 hive 时,它会告诉我以下错误消息:
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)
我应该怎么办?
看起来这是由 Hadoop 在 2019 年年中更新其 Guava 依赖项触发的:HADOOP-15960。该更改在 3.0.4、3.1.3 和 3.2.1 中出现。
Hive 发布了它自己不兼容的 Guava 版本,不仅在 中
lib/guava-*.jar
,而且在内部lib/hive-exec-*.jar
,它重新打包了大量的外部库。因为没有 Hive 就无法工作hive-exec
,我们不能只删除它并从 Hadoop 获取 Guava JAR。hive-exec
的“fat jar”格式至少从 2011 年开始就引起了问题,但到目前为止,他们还没有做太多的事情:hive-exec
他们最终在HIVE-22126中合并了一个更改以遮蔽 Guava(但不是其他库?),但其修复版本是 4.0.0,尚未发布。在这一点上,看起来我们的选择是:
rm /home/hadoop/apache-hive-3.1.2-bin/lib/log4j-slf4j-impl-2.10.0.jar
因为类冲突删除了一个线程,但是还有另一个问题。java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava / lang / String; Ljava / lang / Object; )V