public GlassFishRuntime build(BootstrapProperties bsProps) throws GlassFishException { /* Step 1. Build the classloader. */ // The classloader should contain installRoot/modules/**/*.jar files. String installRoot = getInstallRoot(bsProps); if (installRoot != null) { System.setProperty("org.glassfish.embeddable.installRoot", installRoot); } // Required to add moduleJarURLs to support 'java -jar modules/glassfish.jar case' List<URL> moduleJarURLs = getModuleJarURLs(installRoot); ClassLoader cl = getClass().getClassLoader(); if (!moduleJarURLs.isEmpty()) { cl = new StaticClassLoader(getClass().getClassLoader(), moduleJarURLs); } // Step 2. Setup the module subsystem. Main main = new EmbeddedMain(cl); SingleHK2Factory.initialize(cl); ModulesRegistry modulesRegistry = AbstractFactory.getInstance().createModulesRegistry(); modulesRegistry.setParentClassLoader(cl); // Step 3. Create NonOSGIGlassFishRuntime GlassFishRuntime glassFishRuntime = new StaticGlassFishRuntime(main); logger.logp(Level.FINER, getClass().getName(), "build", "Created GlassFishRuntime {0} with InstallRoot {1}, Bootstrap Options {2}", new Object[]{glassFishRuntime, installRoot, bsProps}); return glassFishRuntime; }
public GlassFishRuntime build(BootstrapProperties bsProps) throws GlassFishException { /* Step 1. Build the classloader. */ // The classloader should contain installRoot/modules/**/*.jar files. String installRoot = getInstallRoot(bsProps); if (installRoot != null) { System.setProperty("org.glassfish.embeddable.installRoot", installRoot); } // Required to add moduleJarURLs to support 'java -jar modules/glassfish.jar case' List<URL> moduleJarURLs = getModuleJarURLs(installRoot); ClassLoader cl = getClass().getClassLoader(); if (!moduleJarURLs.isEmpty()) { cl = new StaticClassLoader(getClass().getClassLoader(), moduleJarURLs); } // Step 2. Setup the module subsystem. Main main = new EmbeddedMain(cl); SingleHK2Factory.initialize(cl); ModulesRegistry modulesRegistry = AbstractFactory.getInstance().createModulesRegistry(); modulesRegistry.setParentClassLoader(cl); // Step 3. Create NonOSGIGlassFishRuntime GlassFishRuntime glassFishRuntime = new StaticGlassFishRuntime(main); logger.logp(Level.FINER, getClass().getName(), "build", "Created GlassFishRuntime {0} with InstallRoot {1}, Bootstrap Options {2}", new Object[]{glassFishRuntime, installRoot, bsProps}); return glassFishRuntime; }