When I was configuring Hive 3.0.0 in Hadoop 3.2.1 environment, I encountered the following error:

Exception in thread "main" java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;Ljava/lang/Object;)V

Root cause

This issue happened because guava lib version is different in Hive lib folder and Hadoop shared folder.  

To fix this, we need to ensure the versions are consistent.

Fix the issue

Follow these steps to fix it:

  • Go to $HIVE_HOME (%HIVE_HOME%)/lib folder and find out the version of guava. For Hive 3.0.0, it is guava-19.0.jar.
  • Go to $HADOOP_HOME (%HADOOP_HOME%)/share/hadoop/common/lib folder and out the version of guava.  For Hadoop 3.2.1, the version is guava-27.0-jre.jar.
  • If they are not same (which is true for this case), delete the older version and copy the newer version in both. In this case, delete guava-19.0.jar in Hive lib folder, and then copy guava-27.0-jre.jar from Hadoop folder to Hive.

Issue resolved!

If your Hive and Hadoop versions are not consistent, you may encounter other similar strange errors like this. The common approach to fix them is to make sure JAR file versions are the same. Typically if you align Hadoop and Hive versions, these issues wouldn't happen. 

info Last modified by Raymond at 2 months ago * This page is subject to Site terms.

More from Kontext

local_offer teradata local_offer python local_offer Java

visibility 135
thumb_up 0
access_time 2 months ago

Python JayDeBeApi module allows you to connect from Python to Teradata databases using Java JDBC drivers. In article Connect to Teradata database through Python , I showed ho...

open_in_new View open_in_new Python Programming

local_offer sqlite local_offer python local_offer Java

visibility 47
thumb_up 0
access_time 2 months ago

To read data from SQLite database in Python, you can use the built-in sqlite3 package . Another approach is to use SQLite JDBC driver via  ...

open_in_new View open_in_new Python Programming

local_offer Java local_offer python local_offer SQL Server

visibility 1287
thumb_up 0
access_time 2 months ago

In my previous article  Connect to SQL Server via JayDeBeApi in Python , I showed examples of u...

open_in_new View open_in_new Python Programming

local_offer hdfs local_offer hadoop local_offer windows

visibility 234
thumb_up 0
access_time 4 months ago

Network Attached Storage are commonly used in many enterprises where files are stored remotely on those servers.  They typically provide access to files using network file sharing protocols such as  ...

open_in_new View open_in_new Hadoop

info About author

Dark theme mode

Dark theme mode is available on Kontext.

Learn more arrow_forward

Kontext Column

Created for everyone to publish data, programming and cloud related articles. Follow three steps to create your columns.


Learn more arrow_forward