Try the following code. I put this in my Activator and it started working. DS is needed to make sure service activation is done. The engine actually contains the implementation of IProfileRegistry. I am not sure if the middle two are needed but updating started working and I didn't want to touch anything.
@Override
public void start(BundleContext context) throws Exception {
ServiceReference packageAdminRef = context.getServiceReference(PackageAdmin.class.getName());
PackageAdmin packageAdmin = (PackageAdmin)context.getService(packageAdminRef);
getBundle("org.eclipse.equinox.ds", packageAdmin); //$NON-NLS-1$
getBundle("org.eclipse.equinox.frameworkadmin.equinox", packageAdmin); //$NON-NLS-1$
getBundle("org.eclipse.equinox.simpleconfigurator.manipulator", packageAdmin); //$NON-NLS-1$
getBundle("org.eclipse.equinox.p2.engine", packageAdmin); //$NON-NLS-1$
}
private static void getBundle(String symbolicName, PackageAdmin packageAdmin)
throws BundleException {
if (packageAdmin != null) {
Bundle[] bundles = packageAdmin.getBundles(symbolicName, null);
if (bundles != null) {
for (int i = 0; i < bundles.length; i++) {
if ((bundles[i].getState() & (Bundle.INSTALLED | Bundle.UNINSTALLED)) == 0) {
bundles[i].start(Bundle.START_TRANSIENT);
}
}
}
}
}
-Phil