if (this.warService == null) {
logger.warn("There are WAR files in the EAR ''{0}'' but the 'web' service is not available", earDeployable);
} else {
// Build context for sending parameters
Context ctx = new ContextImpl(earURL.toExternalForm());
try {
ctx.rebind("earURL", earURL);
} catch (NamingException e) {
throw new DeployerException("Cannot add the EAR URL parameter '" + earURL + "'", e);
}
// Get URLS of the wars and context-root
List<URL> urls = new LinkedList<URL>();
List<String> ctxRoots = new LinkedList<String>();
for (WARDeployable warDeployable : wars) {
// URL
URL url = null;
try {
url = warDeployable.getArchive().getURL();
} catch (ArchiveException e) {
throw new DeployerException("Cannot get the URL for the archive '" + warDeployable.getArchive() + "'",
e);
}
urls.add(url);
// Context-root
ctxRoots.add(warDeployable.getContextRoot());
}
try {
ctx.rebind("urls", urls.toArray(new URL[urls.size()]));
} catch (NamingException e) {
throw new DeployerException("Cannot add the urls parameter '" + urls + "'", e);
}
// Bind the parent classloader of the web application
try {
ctx.rebind("parentClassLoader", parentClassLoader);
} catch (NamingException e) {
throw new DeployerException("Cannot add the parentClassLoader parameter '" + parentClassLoader + "'", e);
}
// Bind the earClassLoader of the web application
try {
ctx.rebind("earClassLoader", earClassLoader);
} catch (NamingException e) {
throw new DeployerException("Cannot add the earClassLoader parameter '" + earClassLoader + "'", e);
}
// No alt-dd yet, give an empty array
try {
ctx.rebind("altDDs", new URL[urls.size()]);
} catch (NamingException e) {
throw new DeployerException("Cannot add the altDDs parameter.'", e);
}
// Build context roots
try {
ctx.rebind("contextRoots", ctxRoots.toArray(new String[ctxRoots.size()]));
} catch (NamingException e) {
throw new DeployerException("Cannot add the contextRoots parameter '" + urls + "'", e);
}
try {