use of com.sun.enterprise.module.bootstrap.BootException in project Payara by payara.
the class EmbeddedOSGiGlassFishRuntime method newGlassFish.
@Override
public synchronized GlassFish newGlassFish(GlassFishProperties gfProps) throws GlassFishException {
try {
// set env props before updating config, because configuration update may actually trigger
// some code to be executed which may be depending on the environment variable values.
setEnv(gfProps.getProperties());
final StartupContext startupContext = new StartupContext(gfProps.getProperties());
final ServiceTracker hk2Tracker = new ServiceTracker(getBundleContext(), Main.class.getName(), null);
hk2Tracker.open();
final Main main = (Main) hk2Tracker.waitForService(0);
hk2Tracker.close();
final ModulesRegistry mr = ModulesRegistry.class.cast(getBundleContext().getService(getBundleContext().getServiceReference(ModulesRegistry.class.getName())));
ServiceLocator serviceLocator = main.createServiceLocator(mr, startupContext, null, null);
final ModuleStartup gfKernel = main.findStartupService(mr, serviceLocator, null, startupContext);
GlassFish glassFish = createGlassFish(gfKernel, serviceLocator, gfProps.getProperties());
gfs.add(glassFish);
return glassFish;
} catch (BootException ex) {
throw new GlassFishException(ex);
} catch (InterruptedException ex) {
throw new GlassFishException(ex);
}
}
Aggregations