Apache Hive:无法实例化org.apache.hadoop.hive.metastore.HiveMetaStoreClient

时间:2015-02-24 12:09:24

标签: java apache hadoop hive

我正在尝试安装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 ...

任何帮助请!

6 个答案:

答案 0 :(得分:1)

你的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,并设置配置单元路径。

export HIVE_HOME=/usr/local/hive

然后通过

打开蜂巢终端
hive

默认情况下,hive使用Derby数据库,如果在创建表时发出Metastore错误,请转到metastore / metastore_db并删除* .lck文件。

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

答案 1 :(得分:1)

hive --service metabore&amp;

此命令将启动Metastore。

答案 2 :(得分:1)

无需启动Metastore,因为运行hive cli的服务也会这样做,只需确保从实例化hive Metastore的同一目录执行hive命令

答案 3 :(得分:0)

如果您是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

答案 4 :(得分:0)

要解决上述问题,启动hive Metastore服务对我有用

   $ hive --service metastore
关于启动Metastore服务的

cloudera参考文档:

http://www.cloudera.com/documentation/archive/cdh/4-x/4-7-1/CDH4-Installation-Guide/cdh4ig_topic_18_6.html

答案 5 :(得分:0)

从属性中,它将仅创建数据库,但不创建模式。尝试在MySQL中创建Hive Metastore所需的模式

cd $ HIVE_HOME / scripts / metastore / upgrade / mysql /  &LT;使用命令登录mysql(mysql -u root -p)其中root是用户名,密码将被询问&gt;

mysql> use metastore;
 mysql> source hive-schema-<your_version>.mysql.sql;

例如source hive-schema-2.1.0.mysql.sql; 然后使用以下命令重启hive Metastore进程:

(蜂巢 - 设备Metastore) 希望这能解决问题!