diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java index 7886f2dee7..847dc04053 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java @@ -995,7 +995,9 @@ public void prepareToStopStandbyServices() throws ServiceFailedException { @Override public void stopStandbyServices() throws IOException { // TODO(HA): Are we guaranteed to be the only active here? - namesystem.stopStandbyServices(); + if (namesystem != null) { + namesystem.stopStandbyServices(); + } } @Override