Buggy code:
public class RaServicesFactory { public static void createDeploymentService ( final ManagementResourceRegistration registration , ConnectorXmlDescriptor connectorXmlDescriptor , Module module , ServiceTarget serviceTarget , final String deploymentUnitName , String deployment , ResourceAdapter raxml ) { ServiceName serviceName = ConnectorServices . registerDeployment ( raxml . getArchive ( ) ) ; ResourceAdapterXmlDeploymentService service = new ResourceAdapterXmlDeploymentService ( connectorXmlDescriptor , raxml , module , deployment , serviceName ) ; ServiceBuilder builder = serviceTarget . addService ( serviceName , service ) . addDependency ( IRONJACAMAR_MDR , MetadataRepository . class , service . getMdrInjector ( ) ) . addDependency ( RA_REPOSITORY_SERVICE , ResourceAdapterRepository . class , service . getRaRepositoryInjector ( ) ) . addDependency ( MANAGEMENT_REPOSITORY_SERVICE , ManagementRepository . class , service . getManagementRepositoryInjector ( ) ) . addDependency ( RESOURCE_ADAPTER_REGISTRY_SERVICE , ResourceAdapterDeploymentRegistry . class , service . getRegistryInjector ( ) ) . addDependency ( TRANSACTION_INTEGRATION_SERVICE , TransactionIntegration . class , service . getTxIntegrationInjector ( ) ) . addDependency ( CONNECTOR_CONFIG_SERVICE , JcaSubsystemConfiguration . class , service . getConfigInjector ( ) ) . addDependency ( SERVICE_NAME , SubjectFactory . class , service . getSubjectFactoryInjector ( ) ) . addDependency ( CCM_SERVICE , CachedConnectionManager . class , service . getCcmInjector ( ) ) . addDependency ( IDLE_REMOVER_SERVICE ) . addDependency ( CONNECTION_VALIDATOR_SERVICE ) . addDependency ( NamingService . SERVICE_NAME ) . addDependency ( RESOURCE_ADAPTER_DEPLOYER_SERVICE_PREFIX . append ( connectorXmlDescriptor . getDeploymentName ( ) ) ) ; builder . addListener ( new org . jboss . msc . service . AbstractServiceListener < Object > ( ) { public void transition ( final ServiceController < ? extends Object > controller , final ServiceController . Transition transition ) { switch ( transition ) { case STARTING_to_UP : { synchronized ( registration ) { CommonDeployment deploymentMD = ( ( ResourceAdapterXmlDeploymentService ) ( controller . getService ( ) ) ) . getRaxmlDeployment ( ) ; if ( ( deploymentMD . getConnectionManagers ( ) ) != null ) { for ( ConnectionManager cm : deploymentMD . getConnectionManagers ( ) ) { if ( ( cm . getPool ( ) ) != null ) { StatisticsPlugin poolStats = cm . getPool ( ) . getStatistics ( ) ; if ( ( poolStats . getNames ( ) . size ( ) ) != 0 ) { DescriptionProvider statsResourceDescriptionProvider = new org . jboss . as . connector . StatisticsDescriptionProvider ( ResourceAdaptersSubsystemProviders . RESOURCE_NAME , "statistics" , poolStats ) ; PathElement pe = PathElement . pathElement ( SUBSYSTEM , SUBSYSTEM_NAME ) ; PathElement peCD = PathElement . pathElement ( CONNECTIONDEFINITIONS_NAME , cm . getJndiName ( ) ) ; ManagementResourceRegistration overrideRegistration = registration ; if ( ( registration . isAllowsOverride ( ) ) && ( ( registration . getOverrideModel ( deploymentUnitName ) ) == null ) ) { overrideRegistration = registration . registerOverrideModel ( deploymentUnitName , new OverrideDescriptionProvider ( ) { @ Override public Map < String , ModelNode > getAttributeOverrideDescriptions ( Locale locale ) { return Collections . emptyMap ( ) ; } @ Override public Map < String , ModelNode > getChildTypeOverrideDescriptions ( Locale locale ) { return Collections . emptyMap ( ) ; } } ) ; } ManagementResourceRegistration subRegistration = overrideRegistration . getSubModel ( PathAddress . pathAddress ( pe ) ) ; if ( subRegistration == null ) { subRegistration = overrideRegistration . registerSubModel ( pe , new org . jboss . as . connector . SubSystemExtensionDescriptionProvider ( ResourceAdaptersSubsystemProviders . RESOURCE_NAME , "statistics" ) ) ; } if ( ( subRegistration . getSubModel ( PathAddress . pathAddress ( peCD ) ) ) == null ) { <START_BUG> ManagementResourceRegistration cdSubRegistration = subRegistration . registerSubModel ( pe , statsResourceDescriptionProvider ) ; <END_BUG> for ( String statName : poolStats . getNames ( ) ) { cdSubRegistration . registerMetric ( statName , new org . jboss . as . connector . pool . PoolMetrics . ParametrizedPoolMetricsHandler ( poolStats ) ) ; } cdSubRegistration . registerOperationHandler ( "clear-statistics" , new org . jboss . as . connector . subsystems . ClearStatisticsHandler ( poolStats ) , CLEAR_STATISTICS_DESC , false ) ; } } } } } } break ; } case UP_to_STOP_REQUESTED : { synchronized ( registration ) { PathElement pe = PathElement . pathElement ( SUBSYSTEM , SUBSYSTEM_NAME ) ; ManagementResourceRegistration overrideRegistration = registration . getOverrideModel ( deploymentUnitName ) ; if ( ( overrideRegistration . getSubModel ( PathAddress . pathAddress ( pe ) ) ) != null ) { overrideRegistration . unregisterSubModel ( pe ) ; } } break ; } } } } ) ; builder . setInitialMode ( ACTIVE ) . install ( ) ; } }

Fix:
ManagementResourceRegistration cdSubRegistration = subRegistration . registerSubModel ( peCD , statsResourceDescriptionProvider ) ;