Buggy code:
public class MessagingExtension implements Extension { public static final String SUBSYSTEM_NAME = "messaging" ; private static final String RESOURCE_NAME = ( MessagingDescriptions . class . getPackage ( ) . getName ( ) ) + ".LocalDescriptions" ; static final PathElement ADDRESS_SETTING = PathElement . pathElement ( CommonAttributes . ADDRESS_SETTING ) ; static final PathElement GENERIC_ACCEPTOR = PathElement . pathElement ( ACCEPTOR ) ; static final PathElement REMOTE_ACCEPTOR = PathElement . pathElement ( CommonAttributes . REMOTE_ACCEPTOR ) ; static final PathElement IN_VM_ACCEPTOR = PathElement . pathElement ( CommonAttributes . IN_VM_ACCEPTOR ) ; static final PathElement GENERIC_CONNECTOR = PathElement . pathElement ( CONNECTOR ) ; static final PathElement REMOTE_CONNECTOR = PathElement . pathElement ( CommonAttributes . REMOTE_CONNECTOR ) ; static final PathElement IN_VM_CONNECTOR = PathElement . pathElement ( CommonAttributes . IN_VM_CONNECTOR ) ; static final PathElement PARAM = PathElement . pathElement ( CommonAttributes . PARAM ) ; private static final PathElement CORE_ADDRESS_PATH = PathElement . pathElement ( CORE_ADDRESS ) ; private static final PathElement CFS_PATH = PathElement . pathElement ( CONNECTION_FACTORY ) ; private static final PathElement JMS_QUEUE_PATH = PathElement . pathElement ( JMS_QUEUE ) ; private static final PathElement TOPIC_PATH = PathElement . pathElement ( JMS_TOPIC ) ; private static final PathElement RA_PATH = PathElement . pathElement ( POOLED_CONNECTION_FACTORY ) ; private static final PathElement BROADCAST_GROUP_PATH = PathElement . pathElement ( BROADCAST_GROUP ) ; private static final PathElement DISCOVERY_GROUP_PATH = PathElement . pathElement ( DISCOVERY_GROUP ) ; private static final PathElement DIVERT_PATH = PathElement . pathElement ( DIVERT ) ; private static final PathElement GROUPING_HANDLER_PATH = PathElement . pathElement ( GROUPING_HANDLER ) ; static final PathElement SECURITY_ROLE = PathElement . pathElement ( ROLE ) ; static final PathElement SECURITY_SETTING = PathElement . pathElement ( CommonAttributes . SECURITY_SETTING ) ; static ResourceDescriptionResolver getResourceDescriptionResolver ( final String keyPrefix ) { } public void initialize ( ExtensionContext context ) { <START_BUG> final SubsystemRegistration subsystem = context . registerSubsystem ( MessagingExtension . SUBSYSTEM_NAME , 1 , 1 ) ; <END_BUG> subsystem . registerXMLElementWriter ( Messaging12SubsystemParser . getInstance ( ) ) ; boolean registerRuntimeOnly = context . isRuntimeOnlyRegistrationValid ( ) ; final ManagementResourceRegistration rootRegistration = subsystem . registerSubsystemModel ( INSTANCE ) ; rootRegistration . registerOperationHandler ( DESCRIBE , MessagingSubsystemDescribeHandler . INSTANCE , MessagingSubsystemDescribeHandler . INSTANCE , false , PRIVATE ) ; final ManagementResourceRegistration serverRegistration = rootRegistration . registerSubModel ( new HornetQServerResourceDefinition ( registerRuntimeOnly ) ) ; if ( registerRuntimeOnly ) { final ManagementResourceRegistration coreAddress = serverRegistration . registerSubModel ( MessagingExtension . CORE_ADDRESS_PATH , MessagingSubsystemProviders . CORE_ADDRESS ) ; coreAddress . setRuntimeOnly ( true ) ; AddressControlHandler . INSTANCE . register ( coreAddress ) ; } final ManagementResourceRegistration addressSetting = serverRegistration . registerSubModel ( MessagingExtension . ADDRESS_SETTING , MessagingSubsystemProviders . ADDRESS_SETTING ) ; addressSetting . registerOperationHandler ( ADD , AddressSettingAdd . INSTANCE , ADDRESS_SETTING_ADD ) ; addressSetting . registerOperationHandler ( REMOVE , AddressSettingRemove . INSTANCE , ADDRESS_SETTING_REMOVE ) ; AddressSettingsWriteHandler . INSTANCE . registerAttributes ( addressSetting , registerRuntimeOnly ) ; final ManagementResourceRegistration broadcastGroups = serverRegistration . registerSubModel ( MessagingExtension . BROADCAST_GROUP_PATH , BROADCAST_GROUP_RESOURCE ) ; broadcastGroups . registerOperationHandler ( ADD , BroadcastGroupAdd . INSTANCE , BroadcastGroupAdd . INSTANCE ) ; broadcastGroups . registerOperationHandler ( REMOVE , BroadcastGroupRemove . INSTANCE , BroadcastGroupRemove . INSTANCE ) ; BroadcastGroupWriteAttributeHandler . INSTANCE . registerAttributes ( broadcastGroups , registerRuntimeOnly ) ; if ( registerRuntimeOnly ) { BroadcastGroupControlHandler . INSTANCE . register ( broadcastGroups ) ; } final ManagementResourceRegistration discoveryGroups = serverRegistration . registerSubModel ( MessagingExtension . DISCOVERY_GROUP_PATH , DISCOVERY_GROUP_RESOURCE ) ; discoveryGroups . registerOperationHandler ( ADD , DiscoveryGroupAdd . INSTANCE , DiscoveryGroupAdd . INSTANCE ) ; discoveryGroups . registerOperationHandler ( REMOVE , DiscoveryGroupRemove . INSTANCE , DiscoveryGroupRemove . INSTANCE ) ; DiscoveryGroupWriteAttributeHandler . INSTANCE . registerAttributes ( discoveryGroups , registerRuntimeOnly ) ; final ManagementResourceRegistration diverts = serverRegistration . registerSubModel ( MessagingExtension . DIVERT_PATH , DIVERT_RESOURCE ) ; diverts . registerOperationHandler ( ADD , DivertAdd . INSTANCE , DivertAdd . INSTANCE ) ; diverts . registerOperationHandler ( REMOVE , DivertRemove . INSTANCE , DivertRemove . INSTANCE ) ; DivertConfigurationWriteHandler . INSTANCE . registerAttributes ( diverts , registerRuntimeOnly ) ; final ManagementResourceRegistration queue = serverRegistration . registerSubModel ( PathElement . pathElement ( CommonAttributes . QUEUE ) , QUEUE_RESOURCE ) ; queue . registerOperationHandler ( ADD , QueueAdd . INSTANCE , QueueAdd . INSTANCE , false ) ; queue . registerOperationHandler ( REMOVE , QueueRemove . INSTANCE , QueueRemove . INSTANCE , false ) ; QueueConfigurationWriteHandler . INSTANCE . registerAttributes ( queue , registerRuntimeOnly ) ; if ( registerRuntimeOnly ) { QueueReadAttributeHandler . INSTANCE . registerAttributes ( queue ) ; QueueControlHandler . INSTANCE . registerOperations ( queue ) ; } final ManagementResourceRegistration acceptor = serverRegistration . registerSubModel ( MessagingExtension . GENERIC_ACCEPTOR , MessagingSubsystemProviders . ACCEPTOR ) ; acceptor . registerOperationHandler ( ADD , GENERIC_ADD , ACCEPTOR_ADD ) ; acceptor . registerOperationHandler ( REMOVE , TransportConfigOperationHandlers . REMOVE , ACCEPTOR_REMOVE ) ; GENERIC_ATTR . registerAttributes ( acceptor , registerRuntimeOnly ) ; MessagingExtension . createParamRegistration ( acceptor ) ; if ( registerRuntimeOnly ) { AcceptorControlHandler . INSTANCE . register ( acceptor ) ; } final ManagementResourceRegistration remoteAcceptor = serverRegistration . registerSubModel ( MessagingExtension . REMOTE_ACCEPTOR , MessagingSubsystemProviders . REMOTE_ACCEPTOR ) ; remoteAcceptor . registerOperationHandler ( ADD , REMOTE_ADD , REMOTE_ACCEPTOR_ADD ) ; remoteAcceptor . registerOperationHandler ( REMOVE , TransportConfigOperationHandlers . REMOVE , ACCEPTOR_REMOVE ) ; REMOTE_ATTR . registerAttributes ( remoteAcceptor , registerRuntimeOnly ) ; MessagingExtension . createParamRegistration ( remoteAcceptor ) ; if ( registerRuntimeOnly ) { AcceptorControlHandler . INSTANCE . register ( remoteAcceptor ) ; } final ManagementResourceRegistration inVMAcceptor = serverRegistration . registerSubModel ( MessagingExtension . IN_VM_ACCEPTOR , MessagingSubsystemProviders . IN_VM_ACCEPTOR ) ; inVMAcceptor . registerOperationHandler ( ADD , IN_VM_ADD , IN_VM_ACCEPTOR_ADD ) ; inVMAcceptor . registerOperationHandler ( REMOVE , TransportConfigOperationHandlers . REMOVE , ACCEPTOR_REMOVE ) ; IN_VM_ATTR . registerAttributes ( inVMAcceptor , registerRuntimeOnly ) ; MessagingExtension . createParamRegistration ( inVMAcceptor ) ; if ( registerRuntimeOnly ) { AcceptorControlHandler . INSTANCE . register ( inVMAcceptor ) ; } final ManagementResourceRegistration connector = serverRegistration . registerSubModel ( MessagingExtension . GENERIC_CONNECTOR , MessagingSubsystemProviders . CONNECTOR ) ; connector . registerOperationHandler ( ADD , GENERIC_ADD , CONNECTOR_ADD ) ;

Fix:
final SubsystemRegistration subsystem = context . registerSubsystem ( MessagingExtension . SUBSYSTEM_NAME , 1 , 2 ) ;