Details
-
Improvement
-
Status: Patch Available
-
Major
-
Resolution: Unresolved
-
3.1.3
Description
When the HMS client fails to connect to the server due to a TTransportException, there is no issue with error reporting.
However, when the failure is caused by an IOException, the exception object, which is used for reporting purposes, remains null. As a result, it does not properly capture the root cause, and end-users encounter an unrelated NPE, masking the actual issue.
Exception in thread "main" java.lang.AssertionError: Unable to connect to HMS!
at TestHMS.main(TestHMS.java:20)
Caused by: java.lang.NullPointerException
at org.apache.hadoop.util.StringUtils.stringifyException(StringUtils.java:90)
at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.open(HiveMetaStoreClient.java:613)
at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.<init>(HiveMetaStoreClient.java:233)
at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.<init>(HiveMetaStoreClient.java:145)
at TestHMS.main(TestHMS.java:13)
The testing code that I used is as below:
import org.apache.hadoop.hive.metastore.HiveMetaStoreClient; import org.apache.hadoop.hive.conf.HiveConf; import java.util.List; public class TestHMS { public static void main(String[] args) { String HOSTNAME = "<hostname>"; HiveConf hiveConf = new HiveConf(); hiveConf.setVar(HiveConf.ConfVars.METASTOREURIS, "thrift://" + HOSTNAME + ":9083"); hiveConf.setBoolVar(HiveConf.ConfVars.METASTORE_USE_THRIFT_SASL, true); hiveConf.setBoolVar(HiveConf.ConfVars.HIVE_METASTORE_USE_SSL, true); try (HiveMetaStoreClient client = new HiveMetaStoreClient(hiveConf)) { List<String> databases = client.getAllDatabases(); System.out.println("Available databases:"); for (String db : databases) { System.out.println(db); } } catch (Exception e) { throw new AssertionError("Unable to connect to HMS!", e); } } }
Attachments
Issue Links
- links to