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条回答
祖国的老花朵
2楼-- · 2020-01-26 06:58

Run this command from the console:

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

Now run

show databases;

If you see an exception as below:

java.sql.SQLException: A read-only user or a user in a read-only database is not permitted to disable read-only mode on a connection.

It means there is some permissions issue with the metastore_db. You need to change the permissions of the complete folder. I am running my hive as hdfs user. So, i used the command

chown -R hdfs:hadoop * 

in the hive directory. This resolved the issue.

查看更多
手持菜刀,她持情操
3楼-- · 2020-01-26 06:58

I was getting the same error but I could not even start the hive shell. After trying the very useful hive debug command:

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

I was able to see that Hive could not find a valid Kerberos TGT. You will see in the debug info something about SASL negotiation failed and no valid Kerberos TGT. My solution was to run

kinit

before running the hive CLI.

查看更多
Luminary・发光体
4楼-- · 2020-01-26 06:58

I was facing the same issue--used the below steps to resolve it:

  1. Create an file hive-site.xml and input the details (for Local/Prod mode). Make sure the below location exist /home/hadoop/bhishm/warehouse

    Example:

    <?xml version="1.0"?>
    <?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
    <configuration>
    <property>
        <name>hive.metastore.warehouse.dir</name>
        <value>/home/hadoop/bhishm/warehouse</value>
        <description>
        Local or HDFS directory where Hive keeps table contents.
        </description>
    </property>
    <property>
        <name>hive.metastore.local</name>
        <value>true</value>
        <description>
        Use false if a production metastore server is used.
        </description>
    </property>
    <property>
        <name>javax.jdo.option.ConnectionURL</name>
        <value>jdbc:derby:;databaseName=/home/hadoop/bhishm/warehouse/metastore_db;create=true</value>
        <description>
        The JDBC connection URL.
        </description>
    </property>
    </configuration>
    
  2. Edit the hive-env.sh--> add the java path as the first line after reducing memory usage:

    Example:

    # Hive Client memory usage can be an issue if a large number of clients
    # are running at the same time. The flags below have been useful in 
    # reducing memory usage:
    
    # The java implementation to use.  Required.
    
    export JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk
    
  3. Run the hive query.

查看更多
乱世女痞
5楼-- · 2020-01-26 06:59

When I used jdk 11, I deploymented hive on my master node and then those exceptions were thrown. Many methods I have tried but useless. Eventually I changed the version of jdk from 11 to 8, which used in master node. Then I started the hive successfully.

查看更多
Juvenile、少年°
6楼-- · 2020-01-26 07:02

If it is in local machine, looks like you have another terminal opened with hive shell/session. You can have only one session using embedded derby data base. Close all other hive sessions and try.

查看更多
乱世女痞
7楼-- · 2020-01-26 07:02

delete code in hive-site.xml and paste this code in hive-site.xml.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?><!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<configuration>
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:derby:;databaseName=/home/hadoop/Desktop/apache-hive-2.1.1-bin/metastore_db;create=true</value>
<description>
JDBC connect string for a JDBC metastore.
To use SSL to encrypt/authenticate the connection, provide database-specific SSL flag in the connection URL.
For example, jdbc:postgresql://myhost/db?ssl=true for postgres database.
</description>
</property>
<property>
<name>hive.metastore.warehouse.dir</name>
<value>/user/hive/warehouse</value>
<description>location of default database for the warehouse</description>
</property>
<property>
<name>hive.metastore.uris</name>
<value/>
<description>Thrift URI for the remote metastore. Used by metastore client to connect to remote metastore.</description>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>org.apache.derby.jdbc.EmbeddedDriver</value>
<description>Driver class name for a JDBC metastore</description>
</property>
<property>
<name>javax.jdo.PersistenceManagerFactoryClass</name>
<value>org.datanucleus.api.jdo.JDOPersistenceManagerFactory</value>
<description>class implementing the jdo persistence</description>
</property>
</configuration>
查看更多
登录 后发表回答