在进行Hadoop系列配置时真的踩了很多坑。
这篇时在Hive初始化:
bin/schematool -dbType derby -initSchema
报错:
Exception in thread "main" java.lang.NoSuchMethodError: com.google.common.base.Preconditions.chng;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:536) at org.apache.hadoop.mapred.JobConf.setJarByClass(JobConf.java:554) at org.apache.hadoop.mapred.JobConf.(JobConf.java:448) 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:323) at org.apache.hadoop.util.RunJar.main(RunJar.java:236)
这是因为hadoop和hive的两个guava.jar版本不一致,解决方案:
第一步:删除hive里的guava.jar
这个保存在hive的lib里,比如我的就在这个目录里面:
/root/apache-hive-3.1.2-bin/lib/
再用指令rm,删除
[root@master apache-hive-3.1.2-bin]# cd lib [root@master lib]# rm guava-19.0.jar rm: remove regular file ‘guava-19.0.jar’? y [root@master lib]# ls
第二步:把hadoop里的复制到hive里
我是先进入到hadoop的lib,再用cp指令复制到hive
(cp -r {要复制的文件} {指定复制过去的路径})
[root@master ~]# cd hadoop-3.2.2/share/hadoop/common/lib [root@master lib]# cp -r guava-27.0-jre.jar /root/apache-hive-3.1.2-bin/lib
最后再回到hive, 再次初始化,终于成功了呜呜呜
[root@master hadoop]# cd /root/apache-hive-3.1.2-bin [root@master apache-hive-3.1.2-bin]# 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
因为没有直接找到详细的解决方案,折腾很久才解决,故在此做一个记录。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)