From f49e697cc850c45b08163ae4afd429302c71b52f Mon Sep 17 00:00:00 2001 From: Eric Yang Date: Thu, 24 May 2018 16:32:13 -0400 Subject: [PATCH] YARN-8357. Fixed NPE when YARN service is saved and not deployed. Contributed by Chandni Singh (cherry picked from commit d9852eb5897a25323ab0302c2c0decb61d310e5e) --- .../org/apache/hadoop/yarn/service/client/ServiceClient.java | 1 + 1 file changed, 1 insertion(+) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/ServiceClient.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/ServiceClient.java index 93a74e3cfa2..0ab332280f2 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/ServiceClient.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/ServiceClient.java @@ -1198,6 +1198,7 @@ public class ServiceClient extends AppAdminClient implements SliderExitCodes, ServiceApiUtil.validateNameFormat(serviceName, getConfig()); Service appSpec = new Service(); appSpec.setName(serviceName); + appSpec.setState(ServiceState.STOPPED); ApplicationId currentAppId = getAppId(serviceName); if (currentAppId == null) { LOG.info("Service {} does not have an application ID", serviceName);