HiveException java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.S

项目场景:

启动mysql后 启动hive,执行 show databases;后出现以下问题。或者在show databases时候报错:Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient
在跟着尚硅谷数仓4.0视频学习的时候,所有都是按照视频中配置,hadoop版本为hadoop3.1.3,hive版本为hive3.1.2。之后就遇到了再启动hive服务之后,使用show databases,报错Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient。网上有视频说是hive的元服务没启动,使用hive --service metastore &启动元服务之后又报错:org.apache.hadoop.conf.Configuration.getPassword(Ljava/lang/String;)[C。
最后把hive版本降到了2.3.9成功解决以上的两个问题。
hive2.3.9可以去清华大学开源软件镜像站自己手动下载,地址链接:https://mirrors.tuna.tsinghua.edu.cn/apache/hive/hive-2.3.9/


问题描述

FAILED: HiveException java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient

在这里插入图片描述


原因分析:

该错误表明无法初始化元数据存储客户端的会话对象,即无法访问Hive元数据。
在这里插入图片描述

解决过程:

metadata服务开启

Hive的metadata服务未开启导致的。
解决办法:

进入到Hive的bin目录下,键入命令:
在这里插入图片描述

报错


MetaException(message:org.apache.hadoop.conf.Configuration.getPassword(Ljava/lang/String;)[C)
at org.apache.hadoop.hive.metastore.RetryingHMSHandler.(RetryingHMSHandler.java:84)
at org.apache.hadoop.hive.metastore.RetryingHMSHandler.getProxy(RetryingHMSHandler.java:93)
at org.apache.hadoop.hive.metastore.HiveMetaStore.newRetryingHMSHandler(HiveMetaStore.java:8661)
at org.apache.hadoop.hive.metastore.HiveMetaStore.newRetryingHMSHandler(HiveMetaStore.java:8656)
at org.apache.hadoop.hive.metastore.HiveMetaStore.startMetaStore(HiveMetaStore.java:8926)
at org.apache.hadoop.hive.metastore.HiveMetaStore.main(HiveMetaStore.java:8843)
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.main(RunJar.java:212)
Caused by: java.lang.NoSuchMethodError: org.apache.hadoop.conf.Configuration.getPassword(Ljava/lang/String;)[C
at org.apache.hadoop.hive.metastore.conf.MetastoreConf.getPassword(MetastoreConf.java:1537)
at org.apache.hadoop.hive.metastore.ObjectStore.getDataSourceProps(ObjectStore.java:606)
at org.apache.hadoop.hive.metastore.ObjectStore.setConf(ObjectStore.java:349)
at org.apache.hadoop.util.ReflectionUtils.setConf(ReflectionUtils.java:73)
at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:133)
at org.apache.hadoop.hive.metastore.RawStoreProxy.(RawStoreProxy.java:59)
at org.apache.hadoop.hive.metastore.RawStoreProxy.getProxy(RawStoreProxy.java:67)
at org.apache.hadoop.hive.metastore.HiveMetaStore H M S H a n d l e r . n e w R a w S t o r e F o r C o n f ( H i v e M e t a S t o r e . j a v a : 718 ) a t o r g . a p a c h e . h a d o o p . h i v e . m e t a s t o r e . H i v e M e t a S t o r e HMSHandler.newRawStoreForConf(HiveMetaStore.java:718) at org.apache.hadoop.hive.metastore.HiveMetaStore HMSHandler.newRawStoreForConf(HiveMetaStore.java:718)atorg.apache.hadoop.hive.metastore.HiveMetaStoreHMSHandler.getMSForConf(HiveMetaStore.java:696)
at org.apache.hadoop.hive.metastore.HiveMetaStore H M S H a n d l e r . g e t M S ( H i v e M e t a S t o r e . j a v a : 690 ) a t o r g . a p a c h e . h a d o o p . h i v e . m e t a s t o r e . H i v e M e t a S t o r e HMSHandler.getMS(HiveMetaStore.java:690) at org.apache.hadoop.hive.metastore.HiveMetaStore HMSHandler.getMS(HiveMetaStore.java:690)atorg.apache.hadoop.hive.metastore.HiveMetaStoreHMSHandler.createDefaultDB(HiveMetaStore.java:767)
at org.apache.hadoop.hive.metastore.HiveMetaStore H M S H a n d l e r . i n i t ( H i v e M e t a S t o r e . j a v a : 538 ) a t s u n . r e f l e c t . N a t i v e M e t h o d A c c e s s o r I m p l . i n v o k e 0 ( N a t i v e M e t h o d ) a t s u n . r e f l e c t . N a t i v e M e t h o d A c c e s s o r I m p l . i n v o k e ( N a t i v e M e t h o d A c c e s s o r I m p l . j a v a : 62 ) a t s u n . r e f l e c t . D e l e g a t i n g M e t h o d A c c e s s o r I m p l . i n v o k e ( D e l e g a t i n g M e t h o d A c c e s s o r I m p l . j a v a : 43 ) a t j a v a . l a n g . r e f l e c t . M e t h o d . i n v o k e ( M e t h o d . j a v a : 498 ) a t o r g . a p a c h e . h a d o o p . h i v e . m e t a s t o r e . R e t r y i n g H M S H a n d l e r . i n v o k e I n t e r n a l ( R e t r y i n g H M S H a n d l e r . j a v a : 147 ) a t o r g . a p a c h e . h a d o o p . h i v e . m e t a s t o r e . R e t r y i n g H M S H a n d l e r . i n v o k e ( R e t r y i n g H M S H a n d l e r . j a v a : 108 ) a t o r g . a p a c h e . h a d o o p . h i v e . m e t a s t o r e . R e t r y i n g H M S H a n d l e r . < i n i t > ( R e t r y i n g H M S H a n d l e r . j a v a : 80 ) . . . 10 m o r e E x c e p t i o n i n t h r e a d " m a i n " M e t a E x c e p t i o n ( m e s s a g e : o r g . a p a c h e . h a d o o p . c o n f . C o n f i g u r a t i o n . g e t P a s s w o r d ( L j a v a / l a n g / S t r i n g ; ) [ C ) a t o r g . a p a c h e . h a d o o p . h i v e . m e t a s t o r e . R e t r y i n g H M S H a n d l e r . < i n i t > ( R e t r y i n g H M S H a n d l e r . j a v a : 84 ) a t o r g . a p a c h e . h a d o o p . h i v e . m e t a s t o r e . R e t r y i n g H M S H a n d l e r . g e t P r o x y ( R e t r y i n g H M S H a n d l e r . j a v a : 93 ) a t o r g . a p a c h e . h a d o o p . h i v e . m e t a s t o r e . H i v e M e t a S t o r e . n e w R e t r y i n g H M S H a n d l e r ( H i v e M e t a S t o r e . j a v a : 8661 ) a t o r g . a p a c h e . h a d o o p . h i v e . m e t a s t o r e . H i v e M e t a S t o r e . n e w R e t r y i n g H M S H a n d l e r ( H i v e M e t a S t o r e . j a v a : 8656 ) a t o r g . a p a c h e . h a d o o p . h i v e . m e t a s t o r e . H i v e M e t a S t o r e . s t a r t M e t a S t o r e ( H i v e M e t a S t o r e . j a v a : 8926 ) a t o r g . a p a c h e . h a d o o p . h i v e . m e t a s t o r e . H i v e M e t a S t o r e . m a i n ( H i v e M e t a S t o r e . j a v a : 8843 ) a t s u n . r e f l e c t . N a t i v e M e t h o d A c c e s s o r I m p l . i n v o k e 0 ( N a t i v e M e t h o d ) a t s u n . r e f l e c t . N a t i v e M e t h o d A c c e s s o r I m p l . i n v o k e ( N a t i v e M e t h o d A c c e s s o r I m p l . j a v a : 62 ) a t s u n . r e f l e c t . D e l e g a t i n g M e t h o d A c c e s s o r I m p l . i n v o k e ( D e l e g a t i n g M e t h o d A c c e s s o r I m p l . j a v a : 43 ) a t j a v a . l a n g . r e f l e c t . M e t h o d . i n v o k e ( M e t h o d . j a v a : 498 ) a t o r g . a p a c h e . h a d o o p . u t i l . R u n J a r . m a i n ( R u n J a r . j a v a : 212 ) C a u s e d b y : j a v a . l a n g . N o S u c h M e t h o d E r r o r : o r g . a p a c h e . h a d o o p . c o n f . C o n f i g u r a t i o n . g e t P a s s w o r d ( L j a v a / l a n g / S t r i n g ; ) [ C a t o r g . a p a c h e . h a d o o p . h i v e . m e t a s t o r e . c o n f . M e t a s t o r e C o n f . g e t P a s s w o r d ( M e t a s t o r e C o n f . j a v a : 1537 ) a t o r g . a p a c h e . h a d o o p . h i v e . m e t a s t o r e . O b j e c t S t o r e . g e t D a t a S o u r c e P r o p s ( O b j e c t S t o r e . j a v a : 606 ) a t o r g . a p a c h e . h a d o o p . h i v e . m e t a s t o r e . O b j e c t S t o r e . s e t C o n f ( O b j e c t S t o r e . j a v a : 349 ) a t o r g . a p a c h e . h a d o o p . u t i l . R e f l e c t i o n U t i l s . s e t C o n f ( R e f l e c t i o n U t i l s . j a v a : 73 ) a t o r g . a p a c h e . h a d o o p . u t i l . R e f l e c t i o n U t i l s . n e w I n s t a n c e ( R e f l e c t i o n U t i l s . j a v a : 133 ) a t o r g . a p a c h e . h a d o o p . h i v e . m e t a s t o r e . R a w S t o r e P r o x y . < i n i t > ( R a w S t o r e P r o x y . j a v a : 59 ) a t o r g . a p a c h e . h a d o o p . h i v e . m e t a s t o r e . R a w S t o r e P r o x y . g e t P r o x y ( R a w S t o r e P r o x y . j a v a : 67 ) a t o r g . a p a c h e . h a d o o p . h i v e . m e t a s t o r e . H i v e M e t a S t o r e HMSHandler.init(HiveMetaStore.java:538) 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.hive.metastore.RetryingHMSHandler.invokeInternal(RetryingHMSHandler.java:147) at org.apache.hadoop.hive.metastore.RetryingHMSHandler.invoke(RetryingHMSHandler.java:108) at org.apache.hadoop.hive.metastore.RetryingHMSHandler.(RetryingHMSHandler.java:80) ... 10 more Exception in thread "main" MetaException(message:org.apache.hadoop.conf.Configuration.getPassword(Ljava/lang/String;)[C) at org.apache.hadoop.hive.metastore.RetryingHMSHandler.(RetryingHMSHandler.java:84) at org.apache.hadoop.hive.metastore.RetryingHMSHandler.getProxy(RetryingHMSHandler.java:93) at org.apache.hadoop.hive.metastore.HiveMetaStore.newRetryingHMSHandler(HiveMetaStore.java:8661) at org.apache.hadoop.hive.metastore.HiveMetaStore.newRetryingHMSHandler(HiveMetaStore.java:8656) at org.apache.hadoop.hive.metastore.HiveMetaStore.startMetaStore(HiveMetaStore.java:8926) at org.apache.hadoop.hive.metastore.HiveMetaStore.main(HiveMetaStore.java:8843) 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.main(RunJar.java:212) Caused by: java.lang.NoSuchMethodError: org.apache.hadoop.conf.Configuration.getPassword(Ljava/lang/String;)[C at org.apache.hadoop.hive.metastore.conf.MetastoreConf.getPassword(MetastoreConf.java:1537) at org.apache.hadoop.hive.metastore.ObjectStore.getDataSourceProps(ObjectStore.java:606) at org.apache.hadoop.hive.metastore.ObjectStore.setConf(ObjectStore.java:349) at org.apache.hadoop.util.ReflectionUtils.setConf(ReflectionUtils.java:73) at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:133) at org.apache.hadoop.hive.metastore.RawStoreProxy.(RawStoreProxy.java:59) at org.apache.hadoop.hive.metastore.RawStoreProxy.getProxy(RawStoreProxy.java:67) at org.apache.hadoop.hive.metastore.HiveMetaStore HMSHandler.init(HiveMetaStore.java:538)atsun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)atsun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)atsun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)atjava.lang.reflect.Method.invoke(Method.java:498)atorg.apache.hadoop.hive.metastore.RetryingHMSHandler.invokeInternal(RetryingHMSHandler.java:147)atorg.apache.hadoop.hive.metastore.RetryingHMSHandler.invoke(RetryingHMSHandler.java:108)atorg.apache.hadoop.hive.metastore.RetryingHMSHandler.<init>(RetryingHMSHandler.java:80)...10moreExceptioninthread"main"MetaException(message:org.apache.hadoop.conf.Configuration.getPassword(Ljava/lang/String;)[C)atorg.apache.hadoop.hive.metastore.RetryingHMSHandler.<init>(RetryingHMSHandler.java:84)atorg.apache.hadoop.hive.metastore.RetryingHMSHandler.getProxy(RetryingHMSHandler.java:93)atorg.apache.hadoop.hive.metastore.HiveMetaStore.newRetryingHMSHandler(HiveMetaStore.java:8661)atorg.apache.hadoop.hive.metastore.HiveMetaStore.newRetryingHMSHandler(HiveMetaStore.java:8656)atorg.apache.hadoop.hive.metastore.HiveMetaStore.startMetaStore(HiveMetaStore.java:8926)atorg.apache.hadoop.hive.metastore.HiveMetaStore.main(HiveMetaStore.java:8843)atsun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)atsun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)atsun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)atjava.lang.reflect.Method.invoke(Method.java:498)atorg.apache.hadoop.util.RunJar.main(RunJar.java:212)Causedby:java.lang.NoSuchMethodError:org.apache.hadoop.conf.Configuration.getPassword(Ljava/lang/String;)[Catorg.apache.hadoop.hive.metastore.conf.MetastoreConf.getPassword(MetastoreConf.java:1537)atorg.apache.hadoop.hive.metastore.ObjectStore.getDataSourceProps(ObjectStore.java:606)atorg.apache.hadoop.hive.metastore.ObjectStore.setConf(ObjectStore.java:349)atorg.apache.hadoop.util.ReflectionUtils.setConf(ReflectionUtils.java:73)atorg.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:133)atorg.apache.hadoop.hive.metastore.RawStoreProxy.<init>(RawStoreProxy.java:59)atorg.apache.hadoop.hive.metastore.RawStoreProxy.getProxy(RawStoreProxy.java:67)atorg.apache.hadoop.hive.metastore.HiveMetaStoreHMSHandler.newRawStoreForConf(HiveMetaStore.java:718)
at org.apache.hadoop.hive.metastore.HiveMetaStore H M S H a n d l e r . g e t M S F o r C o n f ( H i v e M e t a S t o r e . j a v a : 696 ) a t o r g . a p a c h e . h a d o o p . h i v e . m e t a s t o r e . H i v e M e t a S t o r e HMSHandler.getMSForConf(HiveMetaStore.java:696) at org.apache.hadoop.hive.metastore.HiveMetaStore HMSHandler.getMSForConf(HiveMetaStore.java:696)atorg.apache.hadoop.hive.metastore.HiveMetaStoreHMSHandler.getMS(HiveMetaStore.java:690)
at org.apache.hadoop.hive.metastore.HiveMetaStore H M S H a n d l e r . c r e a t e D e f a u l t D B ( H i v e M e t a S t o r e . j a v a : 767 ) a t o r g . a p a c h e . h a d o o p . h i v e . m e t a s t o r e . H i v e M e t a S t o r e HMSHandler.createDefaultDB(HiveMetaStore.java:767) at org.apache.hadoop.hive.metastore.HiveMetaStore HMSHandler.createDefaultDB(HiveMetaStore.java:767)atorg.apache.hadoop.hive.metastore.HiveMetaStoreHMSHandler.init(HiveMetaStore.java:538)
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.hive.metastore.RetryingHMSHandler.invokeInternal(RetryingHMSHandler.java:147)
at org.apache.hadoop.hive.metastore.RetryingHMSHandler.invoke(RetryingHMSHandler.java:108)
at org.apache.hadoop.hive.metastore.RetryingHMSHandler.(RetryingHMSHandler.java:80)
… 10 more
[root@hadoop102 bin]#

解决新方案

把hive版本降到了2.3.9成功解决以上的两个问题。
hive2.3.9可以去清华大学开源软件镜像站自己手动下载,地址链接:https://mirrors.tuna.tsinghua.edu.cn/apache/hive/hive-2.3.9/

安装hive->配置环境变量->修改jar包冲突 -> 初始化元数据

你可能感兴趣的:(hive)