We use Felix as our OSGi framework and Felix Dependency Manager for managing our OSGi Components. We have a situation where we load and validate an XML in the start method of the component. If the validation of the XML against the schema fails, we would like to stop the bundle. We have
- attempted to throw an exception in the start method but the bundle becomes active still
called the stop method of the Bundle in the start method , but this sets the bundle in an unstable ( stopping ) state.
FrameworkUtil.getBundle(this.getClass()).stop();
What is the right way to achieve this requirement viz if the start method has a fatal issue the bundle should remain stopped ?