use of org.jboss.modules.ModuleLoadException in project wildfly by wildfly.
the class ModuleClassLoaderProvider method getServerIntegrationClassLoader.
@Override
public ClassLoader getServerIntegrationClassLoader() {
if (integrationClassLoader == null || integrationClassLoader.get() == null) {
try {
Module module = Module.getBootModuleLoader().loadModule(ASIL);
integrationClassLoader = new WeakReference<ClassLoader>(module.getClassLoader());
} catch (ModuleLoadException e) {
throw new RuntimeException(e);
}
}
return integrationClassLoader.get();
}
use of org.jboss.modules.ModuleLoadException in project wildfly by wildfly.
the class SharedTldsMetaDataBuilder method init.
private void init() {
try {
ModuleClassLoader jstl = Module.getModuleFromCallerModuleLoader(ModuleIdentifier.create("javax.servlet.jstl.api")).getClassLoader();
for (String tld : JSTL_TAGLIBS) {
InputStream is = jstl.getResourceAsStream("META-INF/" + tld);
if (is != null) {
TldMetaData tldMetaData = parseTLD(tld, is);
jstlTlds.add(tldMetaData);
}
}
} catch (ModuleLoadException e) {
// Ignore
} catch (Exception e) {
// Ignore
}
}
use of org.jboss.modules.ModuleLoadException in project wildfly by wildfly.
the class JPADependencyProcessor method addHibernate3AdaptorToDeployment.
private void addHibernate3AdaptorToDeployment(final ModuleLoader moduleLoader, final DeploymentUnit deploymentUnit) {
final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
try {
final Module module = moduleLoader.loadModule(HIBERNATE_3_PROVIDER);
//use a trick to get to the root of the class loader
final URL url = module.getClassLoader().getResource(HIBERNATE3_PROVIDER_ADAPTOR.replace('.', '/') + ".class");
final URLConnection connection = url.openConnection();
if (!(connection instanceof JarURLConnection)) {
throw JpaLogger.ROOT_LOGGER.invalidUrlConnection("hibernate 3", connection);
}
final JarFile jarFile = ((JarURLConnection) connection).getJarFile();
moduleSpecification.addResourceLoader(ResourceLoaderSpec.createResourceLoaderSpec(ResourceLoaders.createJarResourceLoader("hibernate3integration", jarFile)));
// hack in the dependencies which are part of hibernate3integration
// TODO: do this automatically (adding dependencies found in HIBERNATE_3_PROVIDER).
addDependency(moduleSpecification, moduleLoader, deploymentUnit, JBOSS_AS_NAMING_ID, JBOSS_JANDEX_ID);
} catch (ModuleLoadException e) {
throw JpaLogger.ROOT_LOGGER.cannotLoadModule(e, HIBERNATE_3_PROVIDER, "hibernate 3");
} catch (MalformedURLException e) {
throw JpaLogger.ROOT_LOGGER.cannotAddIntegration(e, "hibernate 3");
} catch (IOException e) {
throw new RuntimeException(e);
}
}
use of org.jboss.modules.ModuleLoadException in project teiid by teiid.
the class TranslatorDependencyDeployer method deploy.
@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
try {
final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
// $NON-NLS-1$
final ModuleLoader moduleLoader = Module.getCallerModule().getModule(ModuleIdentifier.create("org.jboss.teiid")).getModuleLoader();
// $NON-NLS-1$
moduleSpecification.addLocalDependency(new ModuleDependency(moduleLoader, ModuleIdentifier.create("org.jboss.teiid.api"), false, false, false, false));
// $NON-NLS-1$
moduleSpecification.addLocalDependency(new ModuleDependency(moduleLoader, ModuleIdentifier.create("org.jboss.teiid.common-core"), false, false, false, false));
// $NON-NLS-1$
moduleSpecification.addLocalDependency(new ModuleDependency(moduleLoader, ModuleIdentifier.create("javax.api"), false, false, false, false));
// $NON-NLS-1$
moduleSpecification.addLocalDependency(new ModuleDependency(moduleLoader, ModuleIdentifier.create("javax.resource.api"), false, false, false, false));
} catch (ModuleLoadException e) {
throw new DeploymentUnitProcessingException(e);
}
}
use of org.jboss.modules.ModuleLoadException in project wildfly by wildfly.
the class SharedTldsMetaDataBuilder method getSharedTlds.
public List<TldMetaData> getSharedTlds(DeploymentUnit deploymentUnit) {
final List<TldMetaData> metadata = new ArrayList<TldMetaData>();
try {
ModuleClassLoader jstl = Module.getModuleFromCallerModuleLoader(ModuleIdentifier.create("javax.servlet.jstl.api")).getClassLoader();
for (String tld : JSTL_TAGLIBS) {
InputStream is = jstl.getResourceAsStream("META-INF/" + tld);
if (is != null) {
TldMetaData tldMetaData = parseTLD(is);
metadata.add(tldMetaData);
}
}
} catch (ModuleLoadException e) {
// Ignore
} catch (Exception e) {
// Ignore
}
List<TldMetaData> additionalSharedTlds = deploymentUnit.getAttachment(ATTACHMENT_KEY);
if (additionalSharedTlds != null) {
metadata.addAll(additionalSharedTlds);
}
return metadata;
}
Aggregations