Search in sources :

Example 1 with ModuleLoadException

use of org.jboss.modules.ModuleLoadException in project wildfly by wildfly.

the class JSFSharedTldsProcessor method init.

private void init() {
    JSFModuleIdFactory moduleFactory = JSFModuleIdFactory.getInstance();
    List<String> jsfSlotNames = moduleFactory.getActiveJSFVersions();
    for (String slot : jsfSlotNames) {
        final List<TldMetaData> jsfTlds = new ArrayList<TldMetaData>();
        try {
            ModuleClassLoader jsf = Module.getModuleFromCallerModuleLoader(moduleFactory.getImplModId(slot)).getClassLoader();
            for (String tld : JSF_TAGLIBS) {
                InputStream is = jsf.getResourceAsStream("META-INF/" + tld);
                if (is != null) {
                    TldMetaData tldMetaData = parseTLD(is);
                    jsfTlds.add(tldMetaData);
                }
            }
        } catch (ModuleLoadException e) {
        // Ignore
        } catch (Exception e) {
        // Ignore
        }
        jsfTldMap.put(slot, jsfTlds);
    }
}
Also used : TldMetaData(org.jboss.metadata.web.spec.TldMetaData) ModuleLoadException(org.jboss.modules.ModuleLoadException) ModuleClassLoader(org.jboss.modules.ModuleClassLoader) InputStream(java.io.InputStream) ArrayList(java.util.ArrayList) IOException(java.io.IOException) ModuleLoadException(org.jboss.modules.ModuleLoadException) DeploymentUnitProcessingException(org.jboss.as.server.deployment.DeploymentUnitProcessingException)

Example 2 with ModuleLoadException

use of org.jboss.modules.ModuleLoadException in project wildfly-swarm by wildfly-swarm.

the class ApplicationEnvironment method getBootstrapClassLoader.

public ClassLoader getBootstrapClassLoader() throws ModuleLoadException {
    if (this.mode == Mode.UBERJAR) {
        try {
            // ClassLoader cl = Module.getBootModuleLoader().loadModule("org.wildfly.swarm.bootstrap").getClassLoader();
            Module module = Module.getBootModuleLoader().loadModule("org.wildfly.swarm.bootstrap");
            ClassLoader cl = module.getClassLoader();
            return cl;
        } catch (ModuleLoadException e) {
        // ignore
        }
    }
    return ApplicationEnvironment.class.getClassLoader();
}
Also used : ModuleLoadException(org.jboss.modules.ModuleLoadException) Module(org.jboss.modules.Module)

Example 3 with ModuleLoadException

use of org.jboss.modules.ModuleLoadException in project wildfly-swarm by wildfly-swarm.

the class BootstrapClasspathModuleFinderTest method testMissingSlot.

@Test
public void testMissingSlot() {
    BootstrapClasspathModuleFinder finder = new BootstrapClasspathModuleFinder();
    try {
        ModuleSpec spec = finder.findModule("classpath.module.load.test:missing", null);
        assertNull(spec);
    } catch (ModuleLoadException e) {
        fail();
    }
}
Also used : ModuleLoadException(org.jboss.modules.ModuleLoadException) ModuleSpec(org.jboss.modules.ModuleSpec) Test(org.junit.Test)

Example 4 with ModuleLoadException

use of org.jboss.modules.ModuleLoadException in project wildfly-swarm by wildfly-swarm.

the class ClasspathModuleFinderTest method testMain.

@Test
public void testMain() {
    ClasspathModuleFinder finder = new ClasspathModuleFinder();
    try {
        ModuleSpec spec = finder.findModule("classpath.module.load.test", null);
        assertNotNull(spec);
    } catch (ModuleLoadException e) {
        fail();
    }
}
Also used : ModuleLoadException(org.jboss.modules.ModuleLoadException) ModuleSpec(org.jboss.modules.ModuleSpec) Test(org.junit.Test)

Example 5 with ModuleLoadException

use of org.jboss.modules.ModuleLoadException in project wildfly-swarm by wildfly-swarm.

the class ClasspathModuleFinderTest method testMissingMain.

@Test
public void testMissingMain() {
    ClasspathModuleFinder finder = new ClasspathModuleFinder();
    try {
        ModuleSpec spec = finder.findModule("classpath.module.load.test.missing", null);
        assertNull(spec);
    } catch (ModuleLoadException e) {
        fail();
    }
}
Also used : ModuleLoadException(org.jboss.modules.ModuleLoadException) ModuleSpec(org.jboss.modules.ModuleSpec) Test(org.junit.Test)

Aggregations

ModuleLoadException (org.jboss.modules.ModuleLoadException)62 Module (org.jboss.modules.Module)30 IOException (java.io.IOException)17 ModuleIdentifier (org.jboss.modules.ModuleIdentifier)13 ModuleSpec (org.jboss.modules.ModuleSpec)12 ModuleLoader (org.jboss.modules.ModuleLoader)10 Test (org.junit.Test)9 URL (java.net.URL)8 File (java.io.File)7 InputStream (java.io.InputStream)7 ArrayList (java.util.ArrayList)7 ModuleClassLoader (org.jboss.modules.ModuleClassLoader)7 HashSet (java.util.HashSet)6 OperationFailedException (org.jboss.as.controller.OperationFailedException)6 DeploymentUnitProcessingException (org.jboss.as.server.deployment.DeploymentUnitProcessingException)6 ModelNode (org.jboss.dmr.ModelNode)6 DeploymentUnit (org.jboss.as.server.deployment.DeploymentUnit)5 TldMetaData (org.jboss.metadata.web.spec.TldMetaData)5 ModuleNotFoundException (org.jboss.modules.ModuleNotFoundException)5 HashMap (java.util.HashMap)4