Buggy code:
final HornetQService hqService = new HornetQService ( configuration , new HornetQService . PathConfig ( bindingsPath , bindingsRelativeToPath , journalPath , journalRelativeToPath , largeMessagePath , largeMessageRelativeToPath , pagingPath , pagingRelativeToPath ) ) ; ServiceName hqServiceName = MessagingServices . getHornetQServiceName ( serverName ) ; final ServiceBuilder < HornetQServer > serviceBuilder = serviceTarget . addService ( hqServiceName , hqService ) . addDependency ( OPTIONAL , JBOSS . append ( "mbean" , "server" ) , MBeanServer . class , hqService . getMBeanServer ( ) ) ; serviceBuilder . addDependency ( SERVICE_NAME , PathManager . class , hqService . getPathManagerInjector ( ) ) ; String domain = CommonAttributes . SECURITY_DOMAIN . resolveModelAttribute ( context , model ) . asString ( ) ; serviceBuilder . addDependency ( REQUIRED , SecurityDomainService . SERVICE_NAME . append ( domain ) , SecurityDomainContext . class , hqService . getSecurityDomainContextInjector ( ) ) ; final Set < String > socketBindings = new HashSet < String > ( ) ; TransportConfigOperationHandlers . processAcceptors ( context , configuration , model , socketBindings ) ; if ( model . hasDefined ( CommonAttributes . HTTP_ACCEPTOR ) ) { for ( final Property property : model . get ( CommonAttributes . HTTP_ACCEPTOR ) . asPropertyList ( ) ) { String httpListener = HTTP_LISTENER . resolveModelAttribute ( context , property . getValue ( ) ) . asString ( ) ; serviceBuilder . addDependency ( HTTP_UPGRADE_REGISTRY . append ( httpListener ) ) ; } } for ( final String socketBinding : socketBindings ) { final ServiceName socketName = JBOSS_BINDING_NAME . append ( socketBinding ) ; serviceBuilder . addDependency ( socketName , SocketBinding . class , hqService . getSocketBindingInjector ( socketBinding ) ) ; } final Set < String > outboundSocketBindings = new HashSet < String > ( ) ; TransportConfigOperationHandlers . processConnectors ( context , configuration , model , outboundSocketBindings ) ; for ( final String outboundSocketBinding : outboundSocketBindings ) { final ServiceName outboundSocketName = OUTBOUND_SOCKET_BINDING_BASE_SERVICE_NAME . append ( outboundSocketBinding ) ; serviceBuilder . addDependency ( OPTIONAL , outboundSocketName , OutboundSocketBinding . class , hqService . getOutboundSocketBindingInjector ( outboundSocketBinding ) ) ; if ( ! ( socketBindings . contains ( outboundSocketBinding ) ) ) { final ServiceName socketName = JBOSS_BINDING_NAME . append ( outboundSocketBinding ) ; serviceBuilder . addDependency ( OPTIONAL , socketName , SocketBinding . class , hqService . getSocketBindingInjector ( outboundSocketBinding ) ) ; } } BroadcastGroupAdd . addBroadcastGroupConfigs ( context , configuration , model ) ; final List < BroadcastGroupConfiguration > broadcastGroupConfigurations = configuration . getBroadcastGroupConfigurations ( ) ; final Map < String , DiscoveryGroupConfiguration > discoveryGroupConfigurations = configuration . getDiscoveryGroupConfigurations ( ) ; if ( broadcastGroupConfigurations != null ) { for ( final BroadcastGroupConfiguration config : broadcastGroupConfigurations ) { final String name = config . getName ( ) ; final String key = "broadcast" + name ; ModelNode broadcastGroupModel = model . get ( CommonAttributes . BROADCAST_GROUP , name ) ; if ( broadcastGroupModel . hasDefined ( CommonAttributes . JGROUPS_STACK . getName ( ) ) ) { String jgroupsStack = CommonAttributes . JGROUPS_STACK . resolveModelAttribute ( context , broadcastGroupModel ) . asString ( ) ; String channelName = CommonAttributes . JGROUPS_CHANNEL . resolveModelAttribute ( context , broadcastGroupModel ) . asString ( ) ; serviceBuilder . addDependency ( CHANNEL_FACTORY . getServiceName ( jgroupsStack ) , ChannelFactory . class , hqService . getJGroupsInjector ( key ) ) ; hqService . getJGroupsChannels ( ) . put ( key , channelName ) ; } else { final ServiceName groupBinding = GroupBindingService . getBroadcastBaseServiceName ( hqServiceName ) . append ( name ) ; serviceBuilder . addDependency ( groupBinding , SocketBinding . class , hqService . getGroupBindingInjector ( key ) ) ; } } } if ( discoveryGroupConfigurations != null ) { for ( final DiscoveryGroupConfiguration config : discoveryGroupConfigurations . values ( ) ) { final String name = config . getName ( ) ; final String key = "discovery" + name ; ModelNode discoveryGroupModel = model . get ( CommonAttributes . DISCOVERY_GROUP , name ) ; if ( discoveryGroupModel . hasDefined ( CommonAttributes . JGROUPS_STACK . getName ( ) ) ) { String jgroupsStack = CommonAttributes . JGROUPS_STACK . resolveModelAttribute ( context , discoveryGroupModel ) . asString ( ) ; String channelName = CommonAttributes . JGROUPS_CHANNEL . resolveModelAttribute ( context , discoveryGroupModel ) . asString ( ) ; serviceBuilder . addDependency ( CHANNEL_FACTORY . getServiceName ( jgroupsStack ) , ChannelFactory . class , hqService . getJGroupsInjector ( key ) ) ; hqService . getJGroupsChannels ( ) . put ( key , channelName ) ; } else { final ServiceName groupBinding = GroupBindingService . getDiscoveryBaseServiceName ( hqServiceName ) . append ( name ) ; serviceBuilder . addDependency ( groupBinding , SocketBinding . class , hqService . getGroupBindingInjector ( key ) ) ; } } } serviceBuilder . addListener ( verificationHandler ) ; ServiceController < HornetQServer > hqServerServiceController = serviceBuilder . install ( ) ; resource . setHornetQServerServiceController ( hqServerServiceController ) ; newControllers . add ( hqServerServiceController ) ; boolean overrideInVMSecurity = CommonAttributes . OVERRIDE_IN_VM_SECURITY . resolveModelAttribute ( context , operation ) . asBoolean ( ) ; <START_BUG> newControllers . add ( JMSService . addService ( serviceTarget , hqServiceName , overrideInVMSecurity , verificationHandler ) ) ; <END_BUG> context . completeStep ( NOOP_ROLLBACK_HANDLER ) ; } } , RUNTIME ) ; } private Configuration transformConfig ( final OperationContext context , String serverName , final ModelNode model ) throws OperationFailedException { } static void processAddressSettings ( final OperationContext context , final Configuration configuration , final ModelNode params ) throws OperationFailedException { } static void processRemotingInterceptors ( final OperationContext context , final Configuration configuration , final ModelNode params ) { } static void processRemotingIncomingInterceptors ( final OperationContext context , final Configuration configuration , final ModelNode params ) { } static void processRemotingOutgoingInterceptors ( final OperationContext context , final Configuration configuration , final ModelNode params ) { } static void processSecuritySettings ( final OperationContext context , final Configuration configuration , final ModelNode params ) throws OperationFailedException { } }

Fix:
newControllers . add ( JMSService . addService ( serviceTarget , hqServiceName , overrideInVMSecurity ) ) ;