- List<AutoCloseable> list = Arrays.asList(bindingContextProvider, clsReg, configRegistry, wrap(bundleTracker),
- configRegReg, configRegistryJMXRegistrator, configRegistryJMXRegistratorWithNotifications, wrap(serviceTracker), moduleInfoRegistryWrapper, notifyingConfigRegistry);
- autoCloseable = OsgiRegistrationUtil.aggregate(list);
- } catch(Exception e) {
- LOG.warn("Error starting config manager", e);
+ final AutoCloseable configMgrReg = OsgiRegistrationUtil.registerService(context, this,
+ ConfigSystemService.class);
+
+ final List<AutoCloseable> list = Arrays.asList(bindingContextProvider, clsReg,
+ OsgiRegistrationUtil.wrap(moduleFactoryBundleTracker), moduleInfoBundleTracker,
+ configRegReg, configRegistryJMXRegistrator, configRegistryJMXRegistratorWithNotifications,
+ OsgiRegistrationUtil.wrap(serviceTracker), moduleInfoRegistryWrapper, notifyingConfigRegistry,
+ configMgrReg);
+ this.autoCloseable = OsgiRegistrationUtil.aggregate(list);
+
+ context.addBundleListener(this);
+ } catch(final Exception e) {
+ LOG.error("Error starting config manager", e);
+ } catch(final Error e) {
+ // Log JVM Error and re-throw. The OSGi container may silently fail the bundle and not always log
+ // the exception. This has been seen on initial feature install.
+ LOG.error("Error starting config manager", e);
+ throw e;