Member since
02-20-2020
1
Post
1
Kudos Received
0
Solutions
04-21-2020
11:46 AM
1 Kudo
Hello @sh1vam , thank you for reporting that your HiveServer2 is not coming up and throwing the below exception: exception in thread "main" java.lang.RuntimeException: org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:578) ... Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient at org.apache.hadoop.hive.ql.metadata.Hive.registerAllFunctionsOnce(Hive.java:226) registerAllFunctionsOnce ... Caused by: javax.jdo.JDOUserException: ... org.datanucleus.store.query.QueryNotUniqueException: The query returned more than one instance BUT either unique is set to true or only aggregates are to be returned, so should have returned one result maximum at ... at org.apache.hadoop.hive.metastore.ObjectStore.getMRole(ObjectStore.java:4091) I found that your issue is resolved now. Therefore I would like to add here the strategy that might be helpful for someone to troubleshoot similar issues: Start reading the stacktrace from bottom-up. Read the last "Caused by:" section first. We can see "QueryNotUniqueException". Now start reading the lines after the Caused by to see if you can find a some meaningful classname that is coming from hive. The first one is: org.apache.hadoop.hive.metastore.ObjectStore.getMRole(ObjectStore.java:4091) Google "org.apache.hadoop.hive.metastore.ObjectStore.getMRole" for the source code. The very first match was this one, which was OK for our purpose. The number in brackets is the line number that we should look up. Since we do not know the exact version you are using, we just search for the term getMRole in the hope we will get the clue what it is. Based on the context it seems to be a Metastore Role that we are trying to fetch. So far we know that a metastore role is not unique. Now we start reading further the caused by sentences and find that this caused that the SessionHiveMetaStoreClient could not be instantiated. Based on your report you found out that the metastore.ROLES table had two admin roles and this was causing the issue and you were using the below commands for your troubleshooting: mysql> select * from metastore.ROLES; You identified that the role with id 3 is not required, hence deleted the role: mysql> delete from metastore.ROLES where ROLE_ID=3; In production environment, please do not forget to create a backup or to have a means of recovery before issuing delete command. Kind regards: Ferenc
... View more