// create the ejb module and set its moduleId to the webapp context root name
EjbModule ejbModule = new EjbModule(webModule.getClassLoader(), getEjbModuleId(standardContext),file.getAbsolutePath(), null, null);
// EJB deployment descriptors
try {
ResourceFinder ejbResourceFinder = new ResourceFinder("", standardContext.getLoader().getClassLoader(), file.toURL());
Map<String, URL> descriptors = ejbResourceFinder.getResourcesMap("META-INF/");
ejbModule.getAltDDs().putAll(descriptors);
} catch (IOException e) {
logger.error("Unable to determine descriptors in jar.", e);
}
// add module to app
appModule.getEjbModules().add(ejbModule);
}
} catch (IOException e) {
logger.warning("Unable to determine the module type of " + url.toExternalForm() + ": Exception: " + e.getMessage(), e);
} catch (UnknownModuleTypeException ignore) {
}
}
// Persistence Units via META-INF/persistence.xml
try {
ResourceFinder finder = new ResourceFinder("", standardContext.getLoader().getClassLoader());
List<URL> persistenceUrls = finder.findAll("META-INF/persistence.xml");
appModule.getAltDDs().put("persistence.xml", persistenceUrls);
} catch (IOException e) {
logger.warning("Cannot load persistence-units from 'META-INF/persistence.xml' : " + e.getMessage(), e);
}