Buggy code:
final class DeploymentUnitPhaseService < T > implements Service < T > { private final InjectedValue < DeployerChains > deployerChainsInjector = new InjectedValue < DeployerChains > ( ) ; private final DeploymentUnit deploymentUnit ; private final Phase phase ; private final AttachmentKey < T > valueKey ; private final List < AttachedDependency > injectedAttachedDepenendencies = new ArrayList < AttachedDependency > ( ) ; private static final Logger log = Logger . getLogger ( "org.jboss.as.server.deployment" ) ; private DeploymentUnitPhaseService ( final DeploymentUnit deploymentUnit , final Phase phase , final AttachmentKey < T > valueKey ) { } private static < T > DeploymentUnitPhaseService < T > create ( final DeploymentUnit deploymentUnit , final Phase phase , AttachmentKey < T > valueKey ) { } static DeploymentUnitPhaseService < ? > create ( final DeploymentUnit deploymentUnit , final Phase phase ) { } @ SuppressWarnings ( "unchecked" ) public synchronized void start ( final StartContext context ) throws StartException { final DeployerChains chains = deployerChainsInjector . getValue ( ) ; final DeploymentUnit deploymentUnit = this . deploymentUnit ; final List < DeploymentUnitProcessor > list = chains . getChain ( phase ) ; final ListIterator < DeploymentUnitProcessor > iterator = list . listIterator ( ) ; final ServiceContainer container = context . getController ( ) . getServiceContainer ( ) ; final ServiceTarget serviceTarget = context . getChildTarget ( ) . subTarget ( ) ; final DeploymentPhaseContext processorContext = new DeploymentPhaseContextImpl ( serviceTarget , new org . jboss . msc . service . DelegatingServiceRegistry ( container ) , deploymentUnit , phase ) ; for ( AttachedDependency attachedDependency : injectedAttachedDepenendencies ) { final Attachable target ; if ( attachedDependency . isDeploymentUnit ( ) ) { target = deploymentUnit ; } else { target = processorContext ; } if ( ( attachedDependency . getAttachmentKey ( ) ) instanceof ListAttachmentKey ) { target . addToAttachmentList ( ( ( AttachmentKey ) ( attachedDependency . getAttachmentKey ( ) ) ) , attachedDependency . getValue ( ) . getValue ( ) ) ; } else { target . putAttachment ( ( ( AttachmentKey ) ( attachedDependency . getAttachmentKey ( ) ) ) , attachedDependency . getValue ( ) . getValue ( ) ) ; } } while ( iterator . hasNext ( ) ) { final DeploymentUnitProcessor processor = iterator . next ( ) ; try { processor . deploy ( processorContext ) ; } catch ( Throwable e ) { while ( iterator . hasPrevious ( ) ) { final DeploymentUnitProcessor prev = iterator . previous ( ) ; DeploymentUnitPhaseService . safeUndeploy ( deploymentUnit , phase , prev ) ; } throw new StartException ( String . format ( "Failed<seq2seq4repair_space>to<seq2seq4repair_space>process<seq2seq4repair_space>phase<seq2seq4repair_space>%s<seq2seq4repair_space>of<seq2seq4repair_space>%s" , phase , deploymentUnit ) , e ) ; } } final Phase nextPhase = phase . next ( ) ; if ( nextPhase != null ) { final String name = deploymentUnit . getName ( ) ; final DeploymentUnit parent = deploymentUnit . getParent ( ) ; final ServiceName serviceName = ( parent == null ) ? Services . deploymentUnitName ( name , nextPhase ) : Services . deploymentUnitName ( parent . getName ( ) , name , nextPhase ) ; final DeploymentUnitPhaseService < ? > phaseService = DeploymentUnitPhaseService . create ( deploymentUnit , nextPhase ) ; final ServiceBuilder < ? > phaseServiceBuilder = serviceTarget . addService ( serviceName , phaseService ) ; phaseServiceBuilder . addDependency ( JBOSS_DEPLOYMENT_CHAINS , DeployerChains . class , phaseService . getDeployerChainsInjector ( ) ) ; phaseServiceBuilder . addDependency ( context . getController ( ) . getName ( ) ) ; final List < ServiceName > nextPhaseDeps = processorContext . getAttachment ( NEXT_PHASE_DEPS ) ; if ( nextPhaseDeps != null ) { phaseServiceBuilder . addDependencies ( nextPhaseDeps ) ; } final List < AttachableDependency > nextPhaseAttachableDeps = processorContext . getAttachment ( NEXT_PHASE_ATTACHABLE_DEPS ) ; if ( nextPhaseAttachableDeps != null ) { for ( AttachableDependency attachableDep : nextPhaseAttachableDeps ) { AttachedDependency result = new AttachedDependency ( attachableDep . getAttachmentKey ( ) , attachableDep . isDeploymentUnit ( ) ) ; phaseServiceBuilder . addDependency ( attachableDep . getServiceName ( ) , result . getValue ( ) ) ; phaseService . injectedAttachedDepenendencies . add ( result ) ; } } if ( ( deploymentUnit . getParent ( ) ) != null ) { <START_BUG> phaseServiceBuilder . addDependencies ( deploymentUnit . getParent ( ) . getServiceName ( ) . append ( nextPhase . name ( ) ) ) ; <END_BUG> } List < DeploymentUnit > subDeployments = deploymentUnit . getAttachmentList ( SUB_DEPLOYMENTS ) ; for ( DeploymentUnit du : subDeployments ) { phaseServiceBuilder . addDependencies ( du . getServiceName ( ) . append ( phase . name ( ) ) ) ; } phaseServiceBuilder . install ( ) ; } } public synchronized void stop ( final StopContext context ) { } private static void safeUndeploy ( final DeploymentUnit deploymentUnit , final Phase phase , final DeploymentUnitProcessor prev ) { } public synchronized T getValue ( ) throws IllegalArgumentException , IllegalStateException { } InjectedValue < DeployerChains > getDeployerChainsInjector ( ) { } }

Fix:
phaseServiceBuilder . addDependencies ( Services . deploymentUnitName ( deploymentUnit . getParent ( ) . getName ( ) , deploymentUnit . getName ( ) , nextPhase ) ) ;