Buggy code:
public class PersistenceUnitDeploymentProcessor implements DeploymentUnitProcessor { public static final String JNDI_PROPERTY = "jboss.entity.manager.factory.jndi.name" ; private final PersistenceUnitRegistryImpl persistenceUnitRegistry ; public PersistenceUnitDeploymentProcessor ( PersistenceUnitRegistryImpl persistenceUnitRegistry ) { } @ Override public void deploy ( DeploymentPhaseContext phaseContext ) throws DeploymentUnitProcessingException { } @ Override public void undeploy ( DeploymentUnit context ) { } private void handleJarDeployment ( DeploymentPhaseContext phaseContext ) throws DeploymentUnitProcessingException { } private void handleWarDeployment ( DeploymentPhaseContext phaseContext ) throws DeploymentUnitProcessingException { } private void handleEarDeployment ( DeploymentPhaseContext phaseContext ) throws DeploymentUnitProcessingException { } private void addPuService ( DeploymentPhaseContext phaseContext , ResourceRoot resourceRoot , ArrayList < PersistenceUnitMetadataHolder > puList ) throws DeploymentUnitProcessingException { } private String adjustJndi ( String dataSourceName ) { } private PersistenceProviderAdaptor getPersistenceProviderAdaptor ( final PersistenceUnitMetadata pu , final PersistenceProviderDeploymentHolder persistenceProviderDeploymentHolder ) throws DeploymentUnitProcessingException { } private PersistenceProvider lookupProvider ( PersistenceUnitMetadata pu ) throws DeploymentUnitProcessingException { } private PersistenceProvider getProviderByName ( PersistenceUnitMetadata pu , String persistenceProviderModule ) { } private boolean isHibernate3 ( PersistenceProvider provider ) { } static boolean isEarDeployment ( final DeploymentUnit context ) { } static boolean isWarDeployment ( final DeploymentUnit context ) { } private static class ManagedReferenceFactoryInjector implements Injector < ManagedReferenceFactory > { private volatile ManagedReference reference ; private final Injector < DataSource > dataSourceInjector ; public ManagedReferenceFactoryInjector ( Injector < DataSource > dataSourceInjector ) { } @ Override public void inject ( final ManagedReferenceFactory value ) throws InjectionException { } @ Override public void uninject ( ) { } } private void addPUServiceDependencyToComponents ( final Collection < ComponentDescription > components , final ServiceName puServiceName ) { } private void addManagementConsole ( final DeploymentUnit deploymentUnit , final PersistenceUnitMetadata pu , final PersistenceUnitService persistenceUnitService , final PersistenceProviderAdaptor adaptor ) { ManagementAdaptor managementAdaptor = adaptor . getManagementAdaptor ( ) ; if ( managementAdaptor != null ) { final String providerLabel = managementAdaptor . getIdentificationLabel ( ) ; final String scopedPersistenceUnitName = pu . getScopedPersistenceUnitName ( ) ; <START_BUG> Resource providerResource = managementAdaptor . createPersistenceUnitResource ( scopedPersistenceUnitName ) ; <END_BUG> ModelNode perPuNode = providerResource . getModel ( ) ; perPuNode . get ( "scoped-unit-name" ) . set ( pu . getScopedPersistenceUnitName ( ) ) ; final Resource deploymentResource = deploymentUnit . getAttachment ( DEPLOYMENT_RESOURCE ) ; Resource subsystemResource ; synchronized ( deploymentResource ) { subsystemResource = PersistenceUnitDeploymentProcessor . getOrCreateResource ( deploymentResource , PathElement . pathElement ( SUBSYSTEM , "jpa" ) ) ; } synchronized ( subsystemResource ) { subsystemResource . registerChild ( PathElement . pathElement ( providerLabel , scopedPersistenceUnitName ) , providerResource ) ; } } } private static Resource getOrCreateResource ( final Resource parent , final PathElement element ) { } }

Fix:
Resource providerResource = managementAdaptor . createPersistenceUnitResource ( scopedPersistenceUnitName , providerLabel ) ;