@SuppressWarnings("unchecked")
    public void addWebApplication(DeployedModule deployedModule, List extensionFactories) throws WebAppNotLoadedException {
        WebGroupConfiguration wgConfig = deployedModule.getWebGroupConfig();
        WebGroup wg = deployedModule.getWebGroup();
        
        String contextRoot = deployedModule.getContextRoot();
        String ct = makeProperContextRoot(contextRoot); // proper
        String mapRoot = makeMappingContextRoot(ct);
        
        String displayName = deployedModule.getDisplayName();

        WebGroup webGroup = (WebGroup) requestMapper.map(mapRoot);

        if (webGroup != null && ct.equalsIgnoreCase(webGroup.getConfiguration().getContextRoot())) {
            //begin 296368    Nested exceptions lost for problems during application startup    WAS.webcontainer    
            List list = webGroup.getWebApps();
            String originalName = "";
            if (list != null && (list.size() > 0)) {
                WebApp originalWebApp = (WebApp) list.get(0);
                originalName = originalWebApp.getWebAppName();
            }
            logger.logp(Level.SEVERE, CLASS_NAME, "addWebApplication", "context.root.already.in.use", new Object[] { displayName, contextRoot, originalName, displayName });
            throw new WebAppNotLoadedException("Context root " + contextRoot + " is already bound. Cannot start application " + displayName);
            // end 296368    Nested exceptions lost for problems during application startup    WAS.webcontainer    

        } else {
            webGroup = wg;
            // begin LIDB2356.1:	WebContainer work for incorporating SIP
            deployedModule.getWebAppConfig().setVirtualHostName(this.getName());

            wgConfig.setWebAppHost(this);
            // end LIDB2356.1:	WebContainer work for incorporating SIP 
            webGroup.initialize(wgConfig);
        }

        try {
            webGroup.addWebApplication(deployedModule, extensionFactories);
            
            Object[] args = { displayName, vHostConfig.toString() };
            if (TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) {
                logger.logp(Level.INFO, CLASS_NAME, "addWebApplication", "module.[{0}].successfully.bound.to.virtualhost.[{1}]", args);
            }
        } catch (Throwable t) {
            //PI58875
            if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)){
                logger.logp(Level.FINE, CLASS_NAME,"addWebApplication",  "error adding web app ["+ displayName +"]");
            }
            webGroup.destroy();
            webGroup = null;
            //PI58875 end 

            //requestMapper.removeMapping(contextRoot);
            //Do not need to remove mapping because we wait until we're sure we should add it!
            //PK67698 removeMapping(contextRoot); 
            throw new WebAppNotLoadedException(t.getMessage(), t); // 296368 added rootCause to newly created exception.
        }

        //PK67698 Start
        try {
            addMapping(contextRoot, webGroup);
            webGroup.notifyStart();
        } catch (Exception exc) {
            // begin 296368    Nested exceptions lost for problems during application startup    WAS.webcontainer    
            if (TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) {
                logger.logp(Level.FINE, CLASS_NAME, "addWebApplication", "error adding mapping ", exc); /* @283348.1 */
            }
            webGroup.destroy();
            throw new WebAppNotLoadedException("Context root " + contextRoot + " mapping unable to be bound. Application " + displayName + " unavailable.", exc);
            // end 296368    Nested exceptions lost for problems during application startup    WAS.webcontainer    
        }
        //PK67698 End
    }
@ SuppressWarnings ( "unchecked" ) public void addWebApplication ( DeployedModule deployedModule , List extensionFactories ) throws WebAppNotLoadedException { WebGroupConfiguration wgConfig = deployedModule . getWebGroupConfig ( ) ; WebGroup wg = deployedModule . getWebGroup ( ) ; String contextRoot = deployedModule . getContextRoot ( ) ; String ct = makeProperContextRoot ( contextRoot ) ; String mapRoot = makeMappingContextRoot ( ct ) ; String displayName = deployedModule . getDisplayName ( ) ; WebGroup webGroup = ( WebGroup ) requestMapper . map ( mapRoot ) ; if ( webGroup != null && ct . equalsIgnoreCase ( webGroup . getConfiguration ( ) . getContextRoot ( ) ) ) { List list = webGroup . getWebApps ( ) ; String originalName = "" ; if ( list != null && ( list . size ( ) > 0 ) ) { WebApp originalWebApp = ( WebApp ) list . get ( 0 ) ; originalName = originalWebApp . getWebAppName ( ) ; } logger . logp ( Level . SEVERE , CLASS_NAME , "addWebApplication" , "context.root.already.in.use" , new Object [ ] { displayName , contextRoot , originalName , displayName } ) ; throw new WebAppNotLoadedException ( "Context root " + contextRoot + " is already bound. Cannot start application " + displayName ) ; } else { webGroup = wg ; deployedModule . getWebAppConfig ( ) . setVirtualHostName ( this . getName ( ) ) ; wgConfig . setWebAppHost ( this ) ; webGroup . initialize ( wgConfig ) ; } try { webGroup . addWebApplication ( deployedModule , extensionFactories ) ; Object [ ] args = { displayName , vHostConfig . toString ( ) } ; if ( TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) ) { logger . logp ( Level . INFO , CLASS_NAME , "addWebApplication" , "module.[{0}].successfully.bound.to.virtualhost.[{1}]" , args ) ; } } catch ( Throwable t ) { if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) ) { logger . logp ( Level . FINE , CLASS_NAME , "addWebApplication" , "error adding web app [" + displayName + "]" ) ; } webGroup . destroy ( ) ; webGroup = null ; throw new WebAppNotLoadedException ( t . getMessage ( ) , t ) ; } try { addMapping ( contextRoot , webGroup ) ; webGroup . notifyStart ( ) ; } catch ( Exception exc ) { if ( TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) ) { logger . logp ( Level . FINE , CLASS_NAME , "addWebApplication" , "error adding mapping " , exc ) ; } webGroup . destroy ( ) ; throw new WebAppNotLoadedException ( "Context root " + contextRoot + " mapping unable to be bound. Application " + displayName + " unavailable." , exc ) ; } }
BEGIN: NEVER INVOKED BY WEBSPHERE APPLICATION SERVER (Common Component Specific)