HIVE-9566: HiveServer2 fails to start with NullPointerException (Na via Xuefu)
Project: http://git-wip-us.apache.org/repos/asf/hive/repo Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/7a3e79fc Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/7a3e79fc Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/7a3e79fc Branch: refs/heads/branch-1.2 Commit: 7a3e79fc0f7991f8132137087a4280bae30f158b Parents: b9a4464 Author: Xuefu Zhang <xzh...@cloudera.com> Authored: Tue Jun 30 05:15:40 2015 -0700 Committer: Pengcheng Xiong <pxi...@apache.org> Committed: Tue Sep 1 16:20:49 2015 -0700 ---------------------------------------------------------------------- .../src/java/org/apache/hive/service/server/HiveServer2.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hive/blob/7a3e79fc/service/src/java/org/apache/hive/service/server/HiveServer2.java ---------------------------------------------------------------------- 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 58e8e49..06c12b8 100644 --- a/service/src/java/org/apache/hive/service/server/HiveServer2.java +++ b/service/src/java/org/apache/hive/service/server/HiveServer2.java @@ -306,7 +306,7 @@ public class HiveServer2 extends CompositeService { 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) { @@ -315,7 +315,7 @@ public class HiveServer2 extends CompositeService { } // 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) { @@ -324,7 +324,7 @@ public class HiveServer2 extends CompositeService { } } - 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) {