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;)
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
- Enter the lib directory of hive
cd /hive/lib
- delete jar package
rm -f guava-19.0.jar
- Copy the jar package of the higher version of Hadoop
cp /hadoop-3.3.0/share/hadoop/common/lib/guava-27.0-jre.jar . //此处后面还有一个点
4. Run again schematool -dbType derby -initSchema
to successfully initialize the metabase.