diff --git a/service/src/java/org/apache/hive/service/server/HiveServer2.java b/service/src/java/org/apache/hive/service/server/HiveServer2.java index 21025a2..d3a428d 100644 --- a/service/src/java/org/apache/hive/service/server/HiveServer2.java +++ b/service/src/java/org/apache/hive/service/server/HiveServer2.java @@ -270,7 +270,7 @@ public synchronized void stop() { HiveConf hiveConf = this.getHiveConf(); super.stop(); // Remove this server instance from ZooKeeper if dynamic service discovery is set - if (hiveConf.getBoolVar(ConfVars.HIVE_SERVER2_SUPPORT_DYNAMIC_SERVICE_DISCOVERY)) { + if (hiveConf != null && hiveConf.getBoolVar(ConfVars.HIVE_SERVER2_SUPPORT_DYNAMIC_SERVICE_DISCOVERY)) { try { removeServerInstanceFromZooKeeper(); } catch (Exception e) { @@ -279,7 +279,7 @@ public synchronized void stop() { } // There should already be an instance of the session pool manager. // If not, ignoring is fine while stopping HiveServer2. - if (hiveConf.getBoolVar(ConfVars.HIVE_SERVER2_TEZ_INITIALIZE_DEFAULT_SESSIONS)) { + if (hiveConf != null && hiveConf.getBoolVar(ConfVars.HIVE_SERVER2_TEZ_INITIALIZE_DEFAULT_SESSIONS)) { try { TezSessionPoolManager.getInstance().stop(); } catch (Exception e) { @@ -288,7 +288,7 @@ public synchronized void stop() { } } - if (hiveConf.getVar(ConfVars.HIVE_EXECUTION_ENGINE).equals("spark")) { + if (hiveConf != null && hiveConf.getVar(ConfVars.HIVE_EXECUTION_ENGINE).equals("spark")) { try { SparkSessionManagerImpl.getInstance().shutdown(); } catch(Exception ex) {