An error is reported when hive initializes the metadata database: Exception in thread “main” java.lang.NoSuchMethodError: com.google.common.base.

An error is reported when hive initializes the metadata database: Exception in thread “main” java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;Ljava/lang/Object;)

insert image description here
We just installed hive and wanted to initialize the database and bin/schematool -dbType derby -initSchema found an error message. At this time, we have to analyze the reason first. The error problem is that the two guava.jar versions of hadoop and hive are inconsistent, and the locations of the two jars are located in different directories.

/hive/lib/guava-19.0.jar 
/hadoop-3.1.4/share/hadoop/common/lib/guava-27.0-jre.jar

Solution: The solution is to delete the lower version and copy the higher version to the lower version directory

  1. Enter the lib directory of hive
cd /hive/lib
  1. delete jar package
rm -f guava-19.0.jar
  1. Copy the jar package of the higher version of Hadoop
 cp /hadoop-3.3.0/share/hadoop/common/lib/guava-27.0-jre.jar .   //此处后面还有一个点

insert image description here
4. Run again schematool -dbType derby -initSchemato successfully initialize the metabase.
insert image description here

Guess you like

Origin blog.csdn.net/m0_58353740/article/details/131579343