Buggy code:
public class WarDeploymentProcessor implements DeploymentUnitProcessor { public static final long PRIORITY = INSTALL_SERVICES . plus ( 300L ) ; private final String defaultHost ; public WarDeploymentProcessor ( String defaultHost ) { } public void processDeployment ( final DeploymentUnitContext context ) throws DeploymentUnitProcessingException { } protected void processDeployment ( final String hostName , final WarMetaData warMetaData , final DeploymentUnitContext context ) throws DeploymentUnitProcessingException { final VirtualFile deploymentRoot = VirtualFileAttachment . getVirtualFileAttachment ( context ) ; final Module module = context . getAttachment ( MODULE_ATTACHMENT_KEY ) ; 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 StandardContext webContext = new StandardContext ( ) ; final ContextConfig config = new JBossContextConfig ( context ) ; try { webContext . setDocBase ( deploymentRoot . getPhysicalFile ( ) . getAbsolutePath ( ) ) ; } catch ( IOException e ) { throw new DeploymentUnitProcessingException ( e ) ; } webContext . addLifecycleListener ( config ) ; final String deploymentName = context . getName ( ) ; String pathName = null ; if ( ( metaData . getContextRoot ( ) ) == null ) { pathName = deploymentRoot . getName ( ) ; if ( pathName . equals ( "ROOT.war" ) ) { pathName = "" ; } else { pathName = "//" + ( pathName . substring ( 0 , ( ( pathName . length ( ) ) - 4 ) ) ) ; } } else { pathName = metaData . getContextRoot ( ) ; if ( "//" . equals ( pathName ) ) { pathName = "" ; } } webContext . setPath ( pathName ) ; webContext . setIgnoreAnnotations ( true ) ; Realm realm = new MemoryRealm ( ) ; webContext . setRealm ( realm ) ; final Loader loader = new WebCtxLoader ( classLoader ) ; final InstanceManager manager = new WebInjectionContainer ( classLoader ) ; webContext . setInstanceManager ( manager ) ; 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 ( ) ; } final BatchBuilder builder = context . getBatchBuilder ( ) ; <START_BUG> builder . addService ( JBOSS_WEB . append ( deploymentName ) , new WebDeploymentService ( webContext ) ) . addDependency ( JBOSS_WEB_HOST . append ( hostName ) , Host . class , new WebContextInjector ( webContext ) ) . setInitialMode ( IMMEDIATE ) ; <END_BUG> } }

Fix:
builder . addService ( JBOSS_WEB . append ( deploymentName ) , new WebDeploymentService ( webContext ) ) . addDependency ( JBOSS_WEB_HOST . append ( hostName ) , Host . class , new WebContextInjector ( webContext ) ) . setInitialMode ( ACTIVE ) ;