Buggy code:
public class WarDeploymentProcessor implements DeploymentUnitProcessor { private final String defaultHost ; public WarDeploymentProcessor ( String defaultHost ) { } @ Override public void deploy ( final DeploymentPhaseContext phaseContext ) throws DeploymentUnitProcessingException { } @ Override public void undeploy ( final DeploymentUnit context ) { } protected void processDeployment ( final String hostName , final WarMetaData warMetaData , final DeploymentUnit deploymentUnit , final ServiceTarget serviceTarget ) throws DeploymentUnitProcessingException { final VirtualFile deploymentRoot = deploymentUnit . getAttachment ( DEPLOYMENT_ROOT ) . getRoot ( ) ; final Module module = deploymentUnit . getAttachment ( MODULE ) ; if ( module == null ) { throw new DeploymentUnitProcessingException ( ( "failed<seq2seq4repair_space>to<seq2seq4repair_space>resolve<seq2seq4repair_space>module<seq2seq4repair_space>for<seq2seq4repair_space>deployment<seq2seq4repair_space>" + deploymentRoot ) ) ; } final ClassLoader classLoader = module . getClassLoader ( ) ; final JBossWebMetaData metaData = warMetaData . getMergedJBossWebMetaData ( ) ; final EEModuleDescription moduleDescription = deploymentUnit . getAttachment ( EE_MODULE_DESCRIPTION ) ; final StandardContext webContext = new StandardContext ( ) ; final ContextConfig config = new JBossContextConfig ( deploymentUnit ) ; webContext . addInstanceListener ( NamingListener . class . getName ( ) ) ; try { webContext . setDocBase ( deploymentRoot . getPhysicalFile ( ) . getAbsolutePath ( ) ) ; } catch ( IOException e ) { throw new DeploymentUnitProcessingException ( e ) ; } webContext . addLifecycleListener ( config ) ; final String deploymentName = deploymentUnit . getName ( ) ; String pathName = null ; if ( ( metaData . getContextRoot ( ) ) == null ) { pathName = "//" + ( deploymentUnit . getName ( ) . substring ( 0 , ( ( deploymentUnit . getName ( ) . length ( ) ) - 4 ) ) ) ; } else { pathName = metaData . getContextRoot ( ) ; if ( "//" . equals ( pathName ) ) { pathName = "" ; } else if ( ( ( pathName . length ( ) ) > 0 ) && ( ( pathName . charAt ( 0 ) ) != '//' ) ) { pathName = "//" + pathName ; } } webContext . setPath ( pathName ) ; webContext . setIgnoreAnnotations ( true ) ; webContext . setCrossContext ( ( ! ( metaData . isDisableCrossContext ( ) ) ) ) ; final WebInjectionContainer injectionContainer = new WebInjectionContainer ( module . getClassLoader ( ) ) ; final Map < String , ComponentInstantiator > components = deploymentUnit . getAttachment ( WEB_COMPONENT_INSTANTIATORS ) ; if ( components != null ) { for ( Map . Entry < String , ComponentInstantiator > entry : components . entrySet ( ) ) { injectionContainer . addInstantiator ( entry . getKey ( ) , entry . getValue ( ) ) ; } } webContext . setInstanceManager ( injectionContainer ) ; final Loader loader = new WebCtxLoader ( classLoader ) ; webContext . setLoader ( loader ) ; switch ( metaData . getSessionCookies ( ) ) { case JBossWebMetaData . SESSION_COOKIES_ENABLED : webContext . setCookies ( true ) ; break ; case JBossWebMetaData . SESSION_COOKIES_DISABLED : webContext . setCookies ( false ) ; break ; } String metaDataSecurityDomain = metaData . getSecurityDomain ( ) ; if ( metaDataSecurityDomain != null ) { metaDataSecurityDomain = metaDataSecurityDomain . trim ( ) ; } String securityDomain = ( metaDataSecurityDomain == null ) ? SecurityConstants . DEFAULT_APPLICATION_POLICY : SecurityUtil . unprefixSecurityDomain ( metaDataSecurityDomain ) ; Map < String , Set < String > > principalVersusRolesMap = metaData . getSecurityRoles ( ) . getPrincipalVersusRolesMap ( ) ; final List < ServletContextAttribute > attributes = deploymentUnit . getAttachment ( ATTACHMENT_KEY ) ; if ( attributes != null ) { final ServletContext context = webContext . getServletContext ( ) ; for ( ServletContextAttribute attribute : attributes ) { context . setAttribute ( attribute . getName ( ) , attribute . getValue ( ) ) ; } } try { JBossWebRealmService realmService = new JBossWebRealmService ( principalVersusRolesMap ) ; ServiceBuilder < ? > builder = serviceTarget . addService ( JBOSS_WEB_REALM . append ( deploymentName ) , realmService ) ; builder . addDependency ( REQUIRED , SERVICE_NAME . append ( securityDomain ) , SecurityDomainContext . class , realmService . getSecurityDomainContextInjector ( ) ) . setInitialMode ( ACTIVE ) . install ( ) ; <START_BUG> WebDeploymentService webDeploymentService = new WebDeploymentService ( webContext ) ; <END_BUG> if ( moduleDescription != null ) { webDeploymentService . getNamespaceSelector ( ) . setValue ( new org . jboss . msc . value . ImmediateValue < org . jboss . as . naming . context . NamespaceContextSelector > ( moduleDescription . getNamespaceContextSelector ( ) ) ) ; } builder = serviceTarget . addService ( JBOSS_WEB . append ( deploymentName ) , webDeploymentService ) ; builder . addDependency ( JBOSS_WEB_HOST . append ( hostName ) , Host . class , new WebContextInjector ( webContext ) ) . addDependencies ( injectionContainer . getServiceNames ( ) ) ; builder . addDependency ( JBOSS_WEB_REALM . append ( deploymentName ) , Realm . class , webDeploymentService . getRealm ( ) ) ; builder . addDependencies ( deploymentUnit . getAttachmentList ( WEB_DEPENDENCIES ) ) ; builder . install ( ) ; } catch ( ServiceRegistryException e ) { throw new DeploymentUnitProcessingException ( "Failed<seq2seq4repair_space>to<seq2seq4repair_space>add<seq2seq4repair_space>JBoss<seq2seq4repair_space>web<seq2seq4repair_space>deployment<seq2seq4repair_space>service" , e ) ; } } }

Fix:
WebDeploymentService webDeploymentService = new WebDeploymentService ( webContext , injectionContainer ) ;