From 100da315a83d979cc19bc4afc4e421374fb2fbd9 Mon Sep 17 00:00:00 2001 From: Francisco Guerrero Date: Wed, 11 Sep 2019 01:00:07 -0700 Subject: [PATCH] HIVE-22190: Class HiveMetaStoreClient fails to instantiate when running on Java 11 HiveMetaStoreClient fails to initialize in JDK with error: Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClient with cause class [Ljava.lang.Object; cannot be cast to class [Ljava.net.URI; ([Ljava.lang.Object; and [Ljava.net.URI; are in module java.base of loader 'bootstrap') This commit refactors the code to convert a List to array --- .../org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java b/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java index 5c472581c5..df587e3c37 100644 --- a/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java +++ b/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java @@ -195,9 +195,9 @@ public HiveMetaStoreClient(HiveConf conf, HiveMetaHookLoader hookLoader, Boolean } // make metastore URIS random - List uriList = Arrays.asList(metastoreUris); + List uriList = Arrays.asList(metastoreUris); Collections.shuffle(uriList); - metastoreUris = (URI[]) uriList.toArray(); + metastoreUris = uriList.toArray(metastoreUris); } catch (IllegalArgumentException e) { throw (e); } catch (Exception e) { -- 2.20.1