Hive 提示:com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;Ljava/lang/Object;)

Posted 在奋斗的大道

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Hive 提示:com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;Ljava/lang/Object;)相关的知识,希望对你有一定的参考价值。

Hive 初始化提示:

[root@node2 apache-hive-3.1.2-bin]# ./bin/hive
which: no hbase in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/opt/java/bin:/opt/maven/bin:/opt/bigdata/hadoop-3.2.2/bin:/opt/bigdata/hadoop-3.2.2/sbin:/opt/bigdata/spark-3.2.0/bin:/opt/bigdata/spark-3.2.0/sbin:/opt/java/bin:/opt/maven/bin:/root/bin)
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/bigdata/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:/opt/bigdata/hadoop-3.2.2/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)

造成此问题原因:guava 版本冲突

hadoop3 guava 依赖jar地址:/usr/local/hadoop/share/hadoop/common/lib/guava-27.0-jre.jar

hive guava 依赖jar地址:/usr/local/hive/lib/guava-19.0.jar

解决办法:

将Hadoop3 依赖的guava.jar 拷贝至/usr/local/hive/lib,删除hive 原有的guava-19.0.jar 包。

以上是关于Hive 提示:com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;Ljava/lang/Object;)的主要内容,如果未能解决你的问题,请参考以下文章

Hive启动报错:java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument

Hive初始化报错Exception in thread “main“ java.lang.NoSuchMethodError: com.google.common.base.Precondition

tried to access methos com.google.common.base.Stopwatch.<init>()V from class org.apache.hadoop...(代码

找不到方法“com.google.common.base.Preconditions.checkState”

这是啥错误:在 com.google.common.base.Preconditions.checkNotNull

NoSuchMethodError:com.google.common.collect.ImmutableList.toImmutableList()