Raymond Raymond

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

event 2020-04-20 visibility 8,834 comment 2 insights toc
more_vert
insights Stats
toc Table of contents

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 find 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. 

More from Kontext
comment Comments
Raymond Raymond #1474 access_time 3 years ago more_vert

It took me a little bit time to fix this issue previously thus I posted it here. I'm glad it is also helping you too.

format_quote

person Tada access_time 3 years ago

Man thanks! Saved my day - I just tried before installing newer version of hadoop and then staying with old Hive and had this issue. Your tutorial fix it!

T Tada Lada #1473 access_time 3 years ago more_vert

Man thanks! Saved my day - I just tried before installing newer version of hadoop and then staying with old Hive and had this issue. Your tutorial fix it!

Please log in or register to comment.

account_circle Log in person_add Register

Log in with external accounts