Buggy code:
private SecuritySubsystemAdd ( ) { } @ Override public OperationResult execute ( OperationContext context , final ModelNode operation , final ResultHandler resultHandler ) { String authenticationManagerClassName = "default" ; String callbackHandlerClassName = "default" ; String subjectFactoryClassName = "default" ; String authorizationManagerClassName = "default" ; String auditManagerClassName = "default" ; String identityTrustManagerClassName = "default" ; String mappingManagerClassName = "default" ; final ModelNode subModel = context . getSubModel ( ) ; if ( operation . hasDefined ( CommonAttributes . AUTHENTICATION_MANAGER_CLASS_NAME ) ) { authenticationManagerClassName = operation . get ( CommonAttributes . AUTHENTICATION_MANAGER_CLASS_NAME ) . asString ( ) ; subModel . get ( CommonAttributes . AUTHENTICATION_MANAGER_CLASS_NAME ) . set ( authenticationManagerClassName ) ; } final boolean deepCopySubject ; if ( operation . hasDefined ( CommonAttributes . DEEP_COPY_SUBJECT_MODE ) ) { deepCopySubject = operation . get ( CommonAttributes . DEEP_COPY_SUBJECT_MODE ) . asBoolean ( ) ; subModel . get ( CommonAttributes . DEEP_COPY_SUBJECT_MODE ) . set ( deepCopySubject ) ; } else { deepCopySubject = SecuritySubsystemAdd . DEFAULT_DEEP_COPY_OPERATION_MODE ; } if ( operation . hasDefined ( CommonAttributes . DEFAULT_CALLBACK_HANDLER_CLASS_NAME ) ) { callbackHandlerClassName = operation . get ( CommonAttributes . DEFAULT_CALLBACK_HANDLER_CLASS_NAME ) . asString ( ) ; subModel . get ( CommonAttributes . DEFAULT_CALLBACK_HANDLER_CLASS_NAME ) . set ( callbackHandlerClassName ) ; } else { callbackHandlerClassName = SecuritySubsystemAdd . CALLBACK_HANDLER ; } if ( operation . hasDefined ( CommonAttributes . SUBJECT_FACTORY_CLASS_NAME ) ) { subjectFactoryClassName = operation . get ( CommonAttributes . SUBJECT_FACTORY_CLASS_NAME ) . asString ( ) ; subModel . get ( CommonAttributes . SUBJECT_FACTORY_CLASS_NAME ) . set ( subjectFactoryClassName ) ; } if ( operation . hasDefined ( CommonAttributes . AUTHORIZATION_MANAGER_CLASS_NAME ) ) { authorizationManagerClassName = operation . get ( CommonAttributes . AUTHORIZATION_MANAGER_CLASS_NAME ) . asString ( ) ; subModel . get ( CommonAttributes . AUTHORIZATION_MANAGER_CLASS_NAME ) . set ( authorizationManagerClassName ) ; } if ( operation . hasDefined ( CommonAttributes . AUDIT_MANAGER_CLASS_NAME ) ) { auditManagerClassName = operation . get ( CommonAttributes . AUDIT_MANAGER_CLASS_NAME ) . asString ( ) ; subModel . get ( CommonAttributes . AUDIT_MANAGER_CLASS_NAME ) . set ( auditManagerClassName ) ; } if ( operation . hasDefined ( CommonAttributes . IDENTITY_TRUST_MANAGER_CLASS_NAME ) ) { identityTrustManagerClassName = operation . get ( CommonAttributes . IDENTITY_TRUST_MANAGER_CLASS_NAME ) . asString ( ) ; subModel . get ( CommonAttributes . IDENTITY_TRUST_MANAGER_CLASS_NAME ) . set ( identityTrustManagerClassName ) ; } if ( operation . hasDefined ( CommonAttributes . MAPPING_MANAGER_CLASS_NAME ) ) { mappingManagerClassName = operation . get ( CommonAttributes . MAPPING_MANAGER_CLASS_NAME ) . asString ( ) ; subModel . get ( CommonAttributes . MAPPING_MANAGER_CLASS_NAME ) . set ( mappingManagerClassName ) ; } subModel . get ( CommonAttributes . SECURITY_DOMAIN ) . setEmptyObject ( ) ; final String resolvedAuthenticationManagerClassName ; if ( "default" . equals ( authenticationManagerClassName ) ) { resolvedAuthenticationManagerClassName = SecuritySubsystemAdd . AUTHENTICATION_MANAGER ; } else { resolvedAuthenticationManagerClassName = authenticationManagerClassName ; } final String resolvedCallbackHandlerClassName ; if ( "default" . equals ( callbackHandlerClassName ) ) { resolvedCallbackHandlerClassName = SecuritySubsystemAdd . CALLBACK_HANDLER ; } else { resolvedCallbackHandlerClassName = callbackHandlerClassName ; } final String resolvedAuthorizationManagerClassName ; if ( "default" . equals ( authorizationManagerClassName ) ) { resolvedAuthorizationManagerClassName = SecuritySubsystemAdd . AUTHORIZATION_MANAGER ; } else { resolvedAuthorizationManagerClassName = authorizationManagerClassName ; } final String resolvedAuditManagerClassName ; if ( "default" . equals ( auditManagerClassName ) ) { resolvedAuditManagerClassName = SecuritySubsystemAdd . AUDIT_MANAGER ; } else { resolvedAuditManagerClassName = auditManagerClassName ; } final String resolvedIdentityTrustManagerClassName ; if ( "default" . equals ( identityTrustManagerClassName ) ) { resolvedIdentityTrustManagerClassName = SecuritySubsystemAdd . IDENTITY_TRUST_MANAGER ; } else { resolvedIdentityTrustManagerClassName = identityTrustManagerClassName ; } final String resolvedMappingManagerClassName ; if ( "default" . equals ( mappingManagerClassName ) ) { resolvedMappingManagerClassName = SecuritySubsystemAdd . MAPPING_MANAGER ; } else { resolvedMappingManagerClassName = mappingManagerClassName ; } final String resolvedSubjectFactoryClassName ; if ( "default" . equals ( subjectFactoryClassName ) ) { resolvedSubjectFactoryClassName = SecuritySubsystemAdd . SUBJECT_FACTORY ; } else { resolvedSubjectFactoryClassName = subjectFactoryClassName ; } if ( context instanceof BootOperationContext ) { final BootOperationContext updateContext = ( ( BootOperationContext ) ( context ) ) ; context . getRuntimeContext ( ) . setRuntimeTask ( new RuntimeTask ( ) { public void execute ( RuntimeTaskContext context ) throws OperationFailedException { updateContext . addDeploymentProcessor ( DEPENDENCIES , DEPENDENCIES_MODULE , new SecurityDependencyProcessor ( ) ) ; final ServiceTarget target = context . getServiceTarget ( ) ; final SecurityBootstrapService bootstrapService = new SecurityBootstrapService ( ) ; target . addService ( SERVICE_NAME , bootstrapService ) . setInitialMode ( ACTIVE ) . install ( ) ; final SecurityDomainJndiInjectable securityDomainJndiInjectable = new SecurityDomainJndiInjectable ( ) ; final BinderService binderService = new BinderService ( "jaas" ) ; <START_BUG> target . addService ( JAVA_CONTEXT_SERVICE_NAME . append ( "jaas" ) , binderService ) . addInjection ( binderService . getJndiInjectableInjector ( ) , securityDomainJndiInjectable ) . addDependency ( JAVA_CONTEXT_SERVICE_NAME , NamingStore . class , binderService . getNamingStoreInjector ( ) ) . addDependency ( SecurityManagementService . SERVICE_NAME , ISecurityManagement . class , securityDomainJndiInjectable . getSecurityManagementInjector ( ) ) . setInitialMode ( ACTIVE ) . install ( ) ; <END_BUG> final SecurityManagementService securityManagementService = new SecurityManagementService ( resolvedAuthenticationManagerClassName , deepCopySubject , resolvedCallbackHandlerClassName , resolvedAuthorizationManagerClassName , resolvedAuditManagerClassName , resolvedIdentityTrustManagerClassName , resolvedMappingManagerClassName ) ; target . addService ( SecurityManagementService . SERVICE_NAME , securityManagementService ) . setInitialMode ( ACTIVE ) . install ( ) ; final SubjectFactoryService subjectFactoryService = new SubjectFactoryService ( resolvedSubjectFactoryClassName ) ; target . addService ( SubjectFactoryService . SERVICE_NAME , subjectFactoryService ) . addDependency ( SecurityManagementService . SERVICE_NAME , ISecurityManagement . class , subjectFactoryService . getSecurityManagementInjector ( ) ) . setInitialMode ( ACTIVE ) . install ( ) ; Configuration loginConfig = XMLLoginConfigImpl . getInstance ( ) ; final JaasConfigurationService jaasConfigurationService = new JaasConfigurationService ( loginConfig ) ; target . addService ( JaasConfigurationService . SERVICE_NAME , jaasConfigurationService ) . setInitialMode ( ACTIVE ) . install ( ) ; resultHandler . handleResultComplete ( ) ; } } ) ; } else { resultHandler . handleResultComplete ( ) ; } final ModelNode compensatingOperation = Util . getResourceRemoveOperation ( operation . require ( OP_ADDR ) ) ; return new org . jboss . as . controller . BasicOperationResult ( compensatingOperation ) ; } }

Fix:
target . addService ( JAVA_CONTEXT_SERVICE_NAME . append ( "jaas" ) , binderService ) . addInjection ( binderService . getManagedObjectInjector ( ) , securityDomainJndiInjectable ) . addDependency ( JAVA_CONTEXT_SERVICE_NAME , NamingStore . class , binderService . getNamingStoreInjector ( ) ) . addDependency ( SecurityManagementService . SERVICE_NAME , ISecurityManagement . class , securityDomainJndiInjectable . getSecurityManagementInjector ( ) ) . setInitialMode ( ACTIVE ) . install ( ) ;