Java Apache Hive:无法实例化 org.apache.hadoop.hive.metastore.HiveMetaStoreClient
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28695444/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Apache Hive : Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClient
提问by Elyes Frikha
I'm trying to install Apache Hive, I insert HIVE_HOME and HADOOP_HOME into hive_config.sh and I copy some hive jar into the $HADOOP_HOME/lib
But when I try to launch it by using hive
command this error appear :
我正在尝试安装 Apache Hive,我将 HIVE_HOME 和 HADOOP_HOME 插入 hive_config.sh 并将一些 hive jar 复制到 $HADOOP_HOME/lib 但是当我尝试使用hive
命令启动它时出现此错误:
Exception in thread "main" java.lang.RuntimeException: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClient
at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:346)
at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:681)
at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:625)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.hadoop.util.RunJar.main(RunJar.java:156)
Caused by: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClient
at org.apache.hadoop.hive.metastore.MetaStoreUtils.newInstance(MetaStoreUtils.java:1412)
at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.<init>(RetryingMetaStoreClient.java:62)
at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.getProxy(RetryingMetaStoreClient.java:72)
at org.apache.hadoop.hive.ql.metadata.Hive.createMetaStoreClient(Hive.java:2453)
at org.apache.hadoop.hive.ql.metadata.Hive.getMSC(Hive.java:2465)
at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:340)
... 7 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.apache.hadoop.hive.metastore.MetaStoreUtils.newInstance(MetaStoreUtils.java:1410)
... 12 more
Caused by: javax.jdo.JDOFatalInternalException: Error creating transactional connection factory
NestedThrowables:
java.lang.reflect.InvocationTargetException
etc ...
ANY HELP PLEASE !
请提供任何帮助!
采纳答案by Kishore
Your hadoop should be in running condition. untar the downloaded hive and give the permission to the directory. Go to the hive/conf directory. Make hive-env.sh.template file to hive-env.sh and hive-default.xml.template file to hive-site.xml. Open hive-evn.sh and set JAVA_HOME in hive-env.sh and HADOOP_HOME and also set the hive path by.
您的 hadoop 应该处于运行状态。解压下载的配置单元并授予目录权限。转到 hive/conf 目录。将 hive-env.sh.template 文件设为 hive-env.sh,将 hive-default.xml.template 文件设为 hive-site.xml。打开 hive-evn.sh 并在 hive-env.sh 和 HADOOP_HOME 中设置 JAVA_HOME 并设置 hive 路径。
export HIVE_HOME=/usr/local/hive
then open hive terminal by
然后通过以下方式打开配置单元终端
hive
by default hive takes Derby database, if it gives error of metastore at the time of create table, go to metastore/metastore_db and delete the *.lck files.
默认情况下,hive 使用 Derby 数据库,如果在创建表时出现 Metastore 错误,请转到 metastore/metastore_db 并删除 *.lck 文件。
Add the JAVA_HOME, HADOOP_HOME, HIVE_HOME in .bashrc or .bash_profile.
在 .bashrc 或 .bash_profile 中添加 JAVA_HOME、HADOOP_HOME、HIVE_HOME。
$cd ~
$vi .bashrc
paste following to the end of the file
#Hadoop variables
export JAVA_HOME=/usr/lib/jvm/jdk/
export PATH=$PATH:$JAVA_HOME/bin
export HADOOP_HOME=/usr/local/hadoop
export PATH=$PATH:$HADOOP_INSTALL/bin
export PATH=$PATH:$HADOOP_INSTALL/sbin
export HADOOP_MAPRED_HOME=$HADOOP_INSTALL
export HADOOP_COMMON_HOME=$HADOOP_INSTALL
export HADOOP_HDFS_HOME=$HADOOP_INSTALL
export YARN_HOME=$HADOOP_INSTALL
export HIVE_HOME=/usr/local/hive
export PATH=$PATH:$HIVE_HOME/bin
###end of paste
回答by Hakan ?lter
If you are a CDH user, you should build Zeppelinwith correct parameters. These parameters will solve the problem for CDH 5.3.3:
如果您是 CDH 用户,您应该使用正确的参数构建Zeppelin。这些参数将解决 CDH 5.3.3 的问题:
mvn clean install -Pspark-1.4 -Phadoop-2.4 -DskipTests -Dspark.version=1.4.0 -Dhadoop.version=2.5.0-cdh5.3.3 -Dhive.hive.version=0.13.1-cdh5.3.3
回答by Aditya
To resolve the above excpetion, starting hive metastore service worked for me
为了解决上述异常,启动 hive Metastore 服务对我有用
$ hive --service metastore
cloudera reference doc on starting metastore service :
关于启动 Metastore 服务的 cloudera 参考文档:
回答by user6608138
hive --service metastore &
hive --service Metastore &
this command will start the metastore.
此命令将启动 Metastore。
回答by anubhav
no need to start metastore as service running hive cli will do same just make sure that you are executing hive command from same directory where you instantiate the hive metastore
无需启动 Metastore,因为运行 hive cli 的服务也会做同样的事情,只需确保您从实例化 hive Metastore 的同一目录中执行 hive 命令
回答by Abhishek Misra
From the property, it will create only the database but not the schema. Try creating the schema required for Hive metastore in MySQL
从属性中,它只会创建数据库而不是模式。尝试在 MySQL 中创建 Hive Metastore 所需的架构
cd $HIVE_HOME/scripts/metastore/upgrade/mysql/ < login to mysql using command (mysql -u root -p) where root is the username and password will be asked>
cd $HIVE_HOME/scripts/metastore/upgrade/mysql/ < login to mysql using command (mysql -u root -p) where root is the username and password will be required>
mysql> use metastore;
mysql> source hive-schema-<your_version>.mysql.sql;
e.g source hive-schema-2.1.0.mysql.sql; Then restart hive metastore process using:
例如 source hive-schema-2.1.0.mysql.sql; 然后使用以下命令重新启动 hive Metastore 进程:
(hive --service metastore) Hopefully, this will solve the problem!
(hive --service metastore) 希望这能解决问题!