ModuleManagerPlugin plugin = bundleManager.getPlugin(ModuleManagerPlugin.class);
ModuleLoader osgiModuleLoader = plugin.getModuleLoader();
// Register the {@link ModuleLoader} with the {@link ClassifyingModuleLoaderService}
ServiceController<?> controller = container.getRequiredService(ClassifyingModuleLoaderService.SERVICE_NAME);
ClassifyingModuleLoaderService moduleLoaderService = (ClassifyingModuleLoaderService) controller.getValue();
Value<ModuleLoader> value = new ImmediateValue<ModuleLoader>(osgiModuleLoader);
osgiModuleLoaderInjector = new ClassifyingModuleLoaderInjector(Constants.JBOSGI_PREFIX, value);
osgiModuleLoaderInjector.inject(moduleLoaderService);
} catch (Throwable t) {
throw new StartException("Failed to create BundleManager", t);