Exception in thread “main“ java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkAr

Source of problem:

        After successfully installing the Hive warehouse in teacher Lin Ziyu's big data course experiment, when starting Hive, the system suddenly reported this error. It was preliminarily determined that the error was caused by jar package compatibility issues. The specific solution is as follows.

Solution:

        First of all, considering that Hive is also developed based on the Java programming language, such a huge application cannot avoid relying on some functional jar packages, so enter the lib dependency folder under the hive installation directory to check, first find the most basic guava dependency package, guava is used It is considered to be an essential tool for Java programmers to develop. It can operate on strings, collections, concurrency, I/O, and reflection. Therefore, for general dependency problems, you will first find out whether the version of the package is incompatible with the guava package that the specified product depends on. After checking, it is found that the dependent file of this machine is guava-19.0.jar, that is, the version of the jar package is 19.0.

        Since the hive warehouse is a data warehouse based on Hadoop, the bottom layer of hive is to automatically convert the query statement entered by the user into a MapReduce task for execution, and return the result to the user. Therefore, hive is also a product that depends on hadoop, so we enter hadoop's public package common to check the guava package we mentioned above, where the common folder is under share/hadoop/common/lib under the hadoop installation directory on your computer. Check and find that the version of the guava function package under this path is 27.0, so after investigation, it is likely that the problem is caused by the low version of the guava package that comes with hive, so delete the guava-19.0.jar in hive/lib/, Then copy one guava-27.0.jar under hadoop/share/hadoop/common/lib to hive/lib/, then restart hive and find that the startup is successful, so the problem is solved.

Guess you like

Origin blog.csdn.net/m0_59705760/article/details/125116629