java.lang.RuntimeException:Unable to instantiate o

2020-01-26 06:22发布

I have configured my Hive as given on link: http://www.youtube.com/watch?v=Dqo1ahdBK_A, but I am getting the following error while creating a table in Hive. I am using hadoop-1.2.1 and hive-0.12.0.

hive> create table employee(emp_id int,name string,salary double);
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClient

17条回答
Explosion°爆炸
2楼-- · 2020-01-26 07:04

this could due to more than one "metastore_db". Remove "metastore_db", restart hadoop cluster and open hive shell from $HIVE_HOME/bin folder

查看更多
叛逆
3楼-- · 2020-01-26 07:10

The answer is located in http://www.cloudera.com/content/cloudera-content/cloudera-docs/CDH5/5.0/CDH5-Installation-Guide/cdh5ig_hive_schema_tool.html

To suppress the schema check and allow the metastore to implicitly modify the schema, you need to set the hive.metastore.schema.verification configuration property to false in hive-site.xml.

查看更多
姐就是有狂的资本
4楼-- · 2020-01-26 07:11

This could be an issue with the metastore like sachinjose described or a connection issue. Run hive console in debug mode like so:

hive -hiveconf hive.root.logger=DEBUG,console

Then execute a simple query like show tables; and see what happens. I ran into this issue after restarting a namenode and it was due to the wrong host being set in the configuration files (ec2 generates new private IP/hostname when restarted).

查看更多
ゆ 、 Hurt°
5楼-- · 2020-01-26 07:11
hive> show databases;
FAILED: Error in metadata: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClient
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask

To resolve this issue start the hadoop services first.

$ start-all.sh

Then I run

hive> show database;

It works fine for me.

查看更多
趁早两清
6楼-- · 2020-01-26 07:12

I was facing the same issue there are some important point's that could be resolve this problem.

1.Put the following at the beginning of hive-site.xml

  <property>
    <name>system:java.io.tmpdir</name>
    <value>/tmp/hive/java</value>
  </property>
  <property>
    <name>system:user.name</name>
    <value>${user.name}</value>
  </property>
  <property>
    <name>javax.jdo.option.ConnectionURL</name>
    <value>jdbc:derby:,databaseName=$HIVE_HOME/metastore_db;create=true</value>
    <description>JDBC connect string for a JDBC metastore </description>
  </property>

this is set relative path in absolute URI and configuring Metastore where the database is stored

2.Remove $HIVE_HOME/metastore_db But Be aware, this will remove your schema completely!

3.Now,You must Initialize Derby database.By default, Hive uses Derby database

$HIVE_HOME/bin/schematool -initSchema -dbType derby

also I suppose that your environment variable has been set correctly ,if not please check them that are looking like below:

export HADOOP_HOME=/usr/local/hadoop 
export PATH=$PATH:$HADOOP_HOME/bin
export PATH=$PATH:$HADOOP_HOME/sbin
export HIVE_HOME=/usr/lib/hive
export PATH=$PATH:$HIVE_HOME/bin

and then run hive command and type show databases;

查看更多
萌系小妹纸
7楼-- · 2020-01-26 07:13

Looks like problem with your metastore. If you are using the default hive metastore embedded derby. Lock file would be there in case of abnormal exit. if you remove that lock file this issue would be solved

rm   metastore_db/*.lck
查看更多
登录 后发表回答