ishpreet ishpreet -3 years ago 425
MySQL Question

Unable to instantiate metadata.SessionHiveMetaStoreClient in Hive(Ubuntu 16.04)

I am trying to setup hive 2.3.0 with mysql on Ubuntu 16.04. I have installed Hadoop and it's running fine. I am able to enter hive console, however no commands are being executed instead it gives me an error:

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

Here's my hive-site.xml

<configuration>
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://localhost/metastore?useSSL=true;</value>
<description>metadata is stored in a MySQL server</description>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
<description>MySQL JDBC driver class</description>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>hiveuser</value>
<description>user name for connecting to mysql server</description>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>hivepassword</value>
<description>password for connecting to mysql server</description>
</property>
</configuration>


I have also created metastore database in mysql using this link.

Error Image

Answer Source

I figured the solution. The issue that Metastore wasn't instantiate is due to duplicated keys in mysql. Instead of Sourcing the the hive schema from mysql. Use this:hive --service metastore

Also to view the complete stack trace use schematool: schematool -initSchema -dbType mysql --verbose

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download