Buggy code:
private Boolean persistenceEnabled ; private Integer journalMinFiles ; private Integer journalFileSize ; private JournalType journalType ; private Set < AbstractTransportElement < ? > > acceptors = new HashSet < AbstractTransportElement < ? > > ( ) ; private Set < AbstractTransportElement < ? > > connectors = new HashSet < AbstractTransportElement < ? > > ( ) ; private Set < SecuritySettingsElement > securitySettings = new HashSet < SecuritySettingsElement > ( ) ; private Set < AddressSettingsElement > addressSettings = new HashSet < AddressSettingsElement > ( ) ; private Set < QueueElement > queues = new HashSet < QueueElement > ( ) ; public MessagingSubsystemAdd ( ) { } @ Override protected < P > void applyUpdate ( UpdateContext updateContext , UpdateResultHandler < ? super Void , P > resultHandler , P param ) { final HornetQService hqservice = new HornetQService ( ) ; final Configuration hqConfig = new ConfigurationImpl ( ) ; if ( ( clustered ) != null ) { hqConfig . setClustered ( clustered ) ; } if ( ( journalMinFiles ) != null ) { hqConfig . setJournalMinFiles ( journalMinFiles ) ; } if ( ( journalFileSize ) != null ) { hqConfig . setJournalFileSize ( journalFileSize ) ; } if ( ( journalType ) != null ) { hqConfig . setJournalType ( journalType ) ; } if ( ( persistenceEnabled ) != null ) { hqConfig . setPersistenceEnabled ( persistenceEnabled ) ; } final Map < String , AddressSettings > configAddressSettings = hqConfig . getAddressesSettings ( ) ; for ( AddressSettingsElement addressSpec : addressSettings ) { final AddressSettings settings = new AddressSettings ( ) ; settings . setAddressFullMessagePolicy ( addressSpec . getAddressFullMessagePolicy ( ) ) ; settings . setDeadLetterAddress ( addressSpec . getDeadLetterAddress ( ) ) ; settings . setExpiryAddress ( addressSpec . getExpiryAddress ( ) ) ; if ( ( addressSpec . isLastValueQueue ( ) ) != null ) { settings . setLastValueQueue ( addressSpec . isLastValueQueue ( ) ) ; } if ( ( addressSpec . getMaxDeliveryAttempts ( ) ) != null ) { settings . setMaxDeliveryAttempts ( addressSpec . getMaxDeliveryAttempts ( ) ) ; } if ( ( addressSpec . getMaxSizeBytes ( ) ) != null ) { settings . setMaxSizeBytes ( addressSpec . getMaxSizeBytes ( ) ) ; } if ( ( addressSpec . getMessageCounterHistoryDayLimit ( ) ) != null ) { settings . setMessageCounterHistoryDayLimit ( addressSpec . getMessageCounterHistoryDayLimit ( ) ) ; } if ( ( addressSpec . getPageSizeBytes ( ) ) != null ) { settings . setPageSizeBytes ( addressSpec . getPageSizeBytes ( ) ) ; } if ( ( addressSpec . getRedeliveryDelay ( ) ) != null ) { settings . setRedeliveryDelay ( addressSpec . getRedeliveryDelay ( ) ) ; } if ( ( addressSpec . getRedistributionDelay ( ) ) != null ) { settings . setRedistributionDelay ( addressSpec . getRedistributionDelay ( ) ) ; } if ( ( addressSpec . isSendToDLAOnNoRoute ( ) ) != null ) { settings . setSendToDLAOnNoRoute ( addressSpec . isSendToDLAOnNoRoute ( ) ) ; } configAddressSettings . put ( addressSpec . getMatch ( ) , settings ) ; } final Map < String , Set < Role > > hqSecurityRoles = hqConfig . getSecurityRoles ( ) ; for ( SecuritySettingsElement securitySetting : securitySettings ) { hqSecurityRoles . put ( securitySetting . getMatch ( ) , securitySetting . getRoles ( ) ) ; } for ( final QueueElement queue : queues ) { hqConfig . getQueueConfigurations ( ) . add ( new org . hornetq . core . config . CoreQueueConfiguration ( queue . getAddress ( ) , queue . getName ( ) , queue . getFilter ( ) , queue . isDurable ( ) ) ) ; } hqservice . setConfiguration ( hqConfig ) ; <START_BUG> final BatchBuilder batchBuilder = updateContext . getBatchBuilder ( ) ; <END_BUG> final ServiceBuilder < HornetQServer > serviceBuilder = batchBuilder . addService ( JBOSS_MESSAGING , hqservice ) . addDependency ( OPTIONAL , JBOSS . append ( "mbean" , "server" ) , MBeanServer . class , hqservice . getMBeanServer ( ) ) ; JMSService . addService ( batchBuilder ) ; MessagingSubsystemAdd . createRelativePathService ( "bindings" , bindingsDirectory , batchBuilder ) ; MessagingSubsystemAdd . addPathDependency ( "bindings" , hqservice , serviceBuilder ) ; MessagingSubsystemAdd . createRelativePathService ( "journal" , journalDirectory , batchBuilder ) ; MessagingSubsystemAdd . addPathDependency ( "journal" , hqservice , serviceBuilder ) ; MessagingSubsystemAdd . createRelativePathService ( "largemessages" , largeMessagesDirectory , batchBuilder ) ; MessagingSubsystemAdd . addPathDependency ( "largemessages" , hqservice , serviceBuilder ) ; MessagingSubsystemAdd . createRelativePathService ( "paging" , pagingDirectory , batchBuilder ) ; MessagingSubsystemAdd . addPathDependency ( "paging" , hqservice , serviceBuilder ) ; final Map < String , TransportConfiguration > connectors = hqConfig . getConnectorConfigurations ( ) ; for ( AbstractTransportElement < ? > connectorSpec : this . connectors ) { final TransportConfiguration transport = new TransportConfiguration ( connectorSpec . getFactoryClassName ( ) , new HashMap < String , Object > ( ) , connectorSpec . getName ( ) ) ; connectorSpec . processHQConfig ( transport ) ; connectors . put ( connectorSpec . getName ( ) , transport ) ; final String socketRef = connectorSpec . getSocketBindingRef ( ) ; if ( socketRef != null ) { final ServiceName socketName = JBOSS_BINDING_NAME . append ( socketRef ) ; serviceBuilder . addDependency ( socketName , SocketBinding . class , hqservice . getSocketBindingInjector ( socketRef ) ) ; } } final Collection < TransportConfiguration > acceptors = hqConfig . getAcceptorConfigurations ( ) ; for ( AbstractTransportElement < ? > acceptorSpec : this . acceptors ) { final TransportConfiguration transport = new TransportConfiguration ( acceptorSpec . getFactoryClassName ( ) , new HashMap < String , Object > ( ) , acceptorSpec . getName ( ) ) ; acceptorSpec . processHQConfig ( transport ) ; acceptors . add ( transport ) ; final String socketRef = acceptorSpec . getSocketBindingRef ( ) ; if ( socketRef != null ) { final ServiceName socketName = JBOSS_BINDING_NAME . append ( socketRef ) ;

Fix:
final BatchBuilder batchBuilder = updateContext . getServiceTarget ( ) ;