欢迎光临
Hive初始化报错Exception in thread “main“ java.lang.NoSuchMethodError: com.google.common.base.
   

Hive初始化报错Exception in thread “main“ java.lang.NoSuchMethodError: com.google.common.base.

一、问题描述

安装好hive后执行初始化命令

[root@bigdata111 hive-3.1.2]# bin/schematool -dbType derby -initSchema

报错信息如下:

Exception in thread "main" java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;Ljava/lang/Object;)V
	at org.apache.hadoop.conf.Configuration.set(Configuration.java:1357)
	at org.apache.hadoop.conf.Configuration.set(Configuration.java:1338)
	at org.apache.hadoop.mapred.JobConf.setJar(JobConf.java:518)
	at org.apache.hadoop.mapred.JobConf.setJarByClass(JobConf.java:536)
	at org.apache.hadoop.mapred.JobConf.(JobConf.java:430)
	at org.apache.hadoop.hive.conf.HiveConf.initialize(HiveConf.java:5141)
	at org.apache.hadoop.hive.conf.HiveConf.(HiveConf.java:5104)
	at org.apache.hive.beeline.HiveSchemaTool.(HiveSchemaTool.java:96)
	at org.apache.hive.beeline.HiveSchemaTool.main(HiveSchemaTool.java:1473)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.hadoop.util.RunJar.run(RunJar.java:318)
	at org.apache.hadoop.util.RunJar.main(RunJar.java:232)

二、问题原因及解决方法

执行初始化命令时发生报错是因为:hadoop和hive的两个guava.jar版本不一致

hive中版本为:guava-19.0.jar

hadoop中的版本为:guava-27.0-jre.jar

第一步:删除hive里的guava-19.0.jar

(1)先到hive的lib目录里

[root@bigdata111 hive-3.1.2]# cd lib/

(2)再用命令rm -fr 删除guava.jar

[root@bigdata111 lib]# rm -fr guava-19.0.jar

第二步:把hadoop里的guava-27.0-jre.jar复制到hive里

(1)先到hadoop的lib目录里

[root@bigdata111 module]# cd hadoop-3.1.3/share/hadoop/common/lib/

(2)用cp指令复制到hive

[root@bigdata111 lib]# cp -r guava-27.0-jre.jar /opt/module/hive-3.1.2/lib/

第三步:回到hive, 再次执行初始化命令

[root@bigdata111 hive-3.1.2]# bin/schematool -dbType derby -initSchema
Metastore connection URL:	 jdbc:derby:;databaseName=metastore_db;create=true
Metastore Connection Driver :	 org.apache.derby.jdbc.EmbeddedDriver
Metastore connection User:	 APP
Starting metastore schema initialization to 3.1.0
Initialization script hive-schema-3.1.0.derby.sql

可以发现问题完美解决!!!

 
 香瓜图片大全大图  莎草科杂草有哪些  大头菜图片  银杏树的简介100字  重庆荣昌花店  雷石东 
打赏
版权声明:本文采用知识共享 署名4.0国际许可协议 [BY-NC-SA] 进行授权
文章名称:《Hive初始化报错Exception in thread “main“ java.lang.NoSuchMethodError: com.google.common.base.》
文章链接:https://goodmancom.com/wl/175846.html

相关推荐