Tag Archives: : java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument

Java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument

Website content quality is poor, distribution efficiency is too low how to do?Huawei engineers offer 5 unique skills>>>

Error message prompted:

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)

The key point is: com.google.common.base.preconditions.checkargument. This is because the version of guava.jar in hive is inconsistent with that in Hadoop. Test method:

Check the guava.jar version in share/Hadoop/common/Lib in the Hadoop installation directory

Check the version of guava.jar in lib under hive installation directory. If the two versions are inconsistent, delete the lower version and copy the higher version to solve the problem

But I found out later that there were other problems

Other versions of guava can be downloaded from the MVN repository

Reference link: https://blog.csdn.net/GQB1226/article/details/102555820