Source:
<code>static void launchServices(OperationContext context, ModelNode model, ManagedAuditLogger auditLoggerInfo, JmxAuthorizer authorizer, RuntimeHostControllerInfoAccessor hostInfoAccessor) throws OperationFailedException { String resolvedDomain = getDomainName(context, model, CommonAttributes.RESOLVED); String expressionsDomain = getDomainName(context, model, CommonAttributes.EXPRESSION); boolean legacyWithProperPropertyFormat = false; if (model.hasDefined(CommonAttributes.PROPER_PROPERTY_FORMAT)) { legacyWithProperPropertyFormat = ExposeModelResourceExpression.DOMAIN_NAME.resolveModelAttribute(context, model).asBoolean(); } boolean coreMBeanSensitivity = JMXSubsystemRootResource.CORE_MBEAN_SENSITIVITY.resolveModelAttribute(context, model).asBoolean(); final boolean isMasterHc; if (context.getProcessType() == ProcessType.HOST_CONTROLLER) { isMasterHc = hostInfoAccessor.getHostControllerInfo(context).isMasterHc(); } else { isMasterHc = false; } <START> if (context.getProcessType() == ProcessType.HOST_CONTROLLER) { <END> ModelNode rootModel = context.readResource(PathAddress.EMPTY_ADDRESS, false).getModel(); String hostName = null; if(rootModel.hasDefined(HOST)) { hostName = rootModel.get(HOST).asString(); } String serverGroup = null; if(rootModel.hasDefined(SERVER_GROUP)) { serverGroup = rootModel.get(SERVER_GROUP).asString(); } authorizer.setJmxEffect(new JmxEffect(hostName, serverGroup)); } MBeanServerService.addService(context.getServiceTarget(), resolvedDomain, expressionsDomain, legacyWithProperPropertyFormat, coreMBeanSensitivity, auditLoggerInfo, authorizer, context.getProcessType(), isMasterHc); }</code><technical_language>change this some. need handle ProcessType.DOMAIN_SERVER; this block right for case. Handling HOST_CONTROLLER is good if this is a host-controller subsystem. there, server-group null (as HC is in a server group)</technical_language>

Target:
static void launchServices(OperationContext context, ModelNode model, ManagedAuditLogger auditLoggerInfo, JmxAuthorizer authorizer, RuntimeHostControllerInfoAccessor hostInfoAccessor) throws OperationFailedException { String resolvedDomain = getDomainName(context, model, CommonAttributes.RESOLVED); String expressionsDomain = getDomainName(context, model, CommonAttributes.EXPRESSION); boolean legacyWithProperPropertyFormat = false; if (model.hasDefined(CommonAttributes.PROPER_PROPERTY_FORMAT)) { legacyWithProperPropertyFormat = ExposeModelResourceExpression.DOMAIN_NAME.resolveModelAttribute(context, model).asBoolean(); } boolean coreMBeanSensitivity = JMXSubsystemRootResource.CORE_MBEAN_SENSITIVITY.resolveModelAttribute(context, model).asBoolean(); final boolean isMasterHc; if (context.getProcessType() == ProcessType.HOST_CONTROLLER) { isMasterHc = hostInfoAccessor.getHostControllerInfo(context).isMasterHc(); } else { isMasterHc = false; } JmxEffect jmxEffect = null; if (context.getProcessType() == ProcessType.DOMAIN_SERVER) { ModelNode rootModel = context.readResourceFromRoot(PathAddress.EMPTY_ADDRESS, false).getModel(); String hostName = null; if(rootModel.hasDefined(HOST)) { hostName = rootModel.get(HOST).asString(); } String serverGroup = null; if(rootModel.hasDefined(SERVER_GROUP)) { serverGroup = rootModel.get(SERVER_GROUP).asString(); } jmxEffect = new JmxEffect(hostName, serverGroup); } MBeanServerService.addService(context.getServiceTarget(), resolvedDomain, expressionsDomain, legacyWithProperPropertyFormat, coreMBeanSensitivity, auditLoggerInfo, authorizer, jmxEffect, context.getProcessType(), isMasterHc); }