WebDeployable webDeployable = new WebDeployable(WarUrl);
DDBeanRoot ddBeanRoot = webDeployable.getDDBeanRoot();
DDBean ddBean = ddBeanRoot.getChildBean("web-app")[0];
Kernel kernel = PortletManager.getKernel();
DeploymentFactory factory = new DeploymentFactoryWithKernel(kernel);
DeploymentManager deploymentManager = factory.getDeploymentManager("deployer:geronimo:inVM", null, null);
DeploymentConfiguration deploymentConfiguration = deploymentManager.createConfiguration(webDeployable);
WebAppDConfigRoot configRoot = (WebAppDConfigRoot) deploymentConfiguration.getDConfigBeanRoot(ddBeanRoot);
WebAppDConfigBean webApp = (WebAppDConfigBean) configRoot.getDConfigBean(ddBean);
webApp.setContextRoot(data.getContextRoot());