java.lang.RuntimeException:Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClient
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
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).
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.