{
server.start();
}
catch (final Exception e)
{
throw new LifecycleException("Error in starting the Microcontainer server " + server, e);
}
// Install the ShrinkWrapDeployer
final URL shrinkwrapDeployerJBossBeans = Thread.currentThread().getContextClassLoader()
.getResource(FILENAME_SHRINKWRAP_DEPLOYER_XML);
assert shrinkwrapDeployerJBossBeans != null : "ShrinkWrap Deployer beans XML not found";
final MainDeployer mainDeployer = (MainDeployer) server.getKernel().getController()
.getContextByClass(MainDeployer.class).getTarget();
final VirtualFile file;
try
{
file = VFS.getChild(shrinkwrapDeployerJBossBeans);
}
catch (final URISyntaxException e)
{
throw new LifecycleException("Could not create virtual file for " + shrinkwrapDeployerJBossBeans, e);
}
if (file == null)
{
throw new IllegalStateException();
}
final VFSDeployment deployment = VFSDeploymentFactory.getInstance().createVFSDeployment(file);
try
{
mainDeployer.addDeployment(deployment);
mainDeployer.process();
mainDeployer.checkComplete();
}
catch (final org.jboss.deployers.spi.DeploymentException de)
{
throw new LifecycleException("Could not install ShrinkWrapDeployer", de);
}
// Get the ShrinkWrapDeployer
final ShrinkWrapDeployer deployer = (ShrinkWrapDeployer) server.getKernel().getController()
.getInstalledContext(NAME_MC_SHRINKWRAP_DEPLOYER).getTarget();