killbill-aplcache

osgi: improve robustness on startup If a bundle fails to start,

2/8/2013 10:53:00 PM

Details

diff --git a/osgi/src/main/java/com/ning/billing/osgi/DefaultOSGIService.java b/osgi/src/main/java/com/ning/billing/osgi/DefaultOSGIService.java
index bdf7ff6..d37acd0 100644
--- a/osgi/src/main/java/com/ning/billing/osgi/DefaultOSGIService.java
+++ b/osgi/src/main/java/com/ning/billing/osgi/DefaultOSGIService.java
@@ -136,7 +136,7 @@ public class DefaultOSGIService implements OSGIService {
         }
     }
 
-    private void installAndStartBundles(final Framework framework) throws BundleException {
+    private void installAndStartBundles(final Framework framework) {
         try {
             final BundleContext context = framework.getBundleContext();
 
@@ -148,10 +148,16 @@ public class DefaultOSGIService implements OSGIService {
             // Start all the bundles
             for (final Bundle bundle : installedBundles) {
                 logger.info("Starting bundle {}", bundle.getLocation());
-                bundle.start();
+                try {
+                    bundle.start();
+                } catch (BundleException e) {
+                    logger.warn("Unable to start bundle", e);
+                }
             }
         } catch (PluginConfigException e) {
             logger.error("Error while parsing plugin configurations", e);
+        } catch (BundleException e) {
+            logger.error("Error while parsing plugin configurations", e);
         }
     }