@Override public void stop(final BundleContext context) { // remove bundle listener context.removeBundleListener(this); // forget our bundle context bundleContext = null; // unregister all classloaders ClassLoaderUtil.unregisterAllBundleClassLoaders(); // The SessionFactory service will be unregistered automatically }