Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[p2-dev] P2 Uninstall/Update IU operations does not work.

Dear P2 Developer, 

I would like first to thank you guys for your help and time you provide, the following here is my issue with P2

We are developing an OSGI-based project and we use P2 as provisioning framework for our system. 

- To build the project we use Tycho, the results are Eclipse executable products which we take them and run their executables, after running them, the osgi console shows for example the bundles are running or installed or resolved as normal. 
- We have our own repository which we add and then we can further install more bundles and i can say installation (InstallOperation) works fine. 
- While the product is running (for example our server product which runs using Jetty), we want to delete or update some running (active bundles) but neither delete nor update are working. 
- After long research we found out that p2 does not delete a bundle (IU) (even if it does a certain way) if there is no garbage collector implementation provided, thus, i have implemented the garbage collector as described in a forum as follow: 

private void collectGarbage() throws Exception {
		IApplication app = null;
		IExtensionRegistry reg = Platform.getExtensionRegistry();
		IExtensionPoint ep = reg.getExtensionPoint(APPLICATION_EXT_POINT);
		IExtension[] extensions = ep.getExtensions();
		found: for (int i = 0; i < extensions.length; i++) { 
			System.out.println("Extensions have been found");
			IExtension ext = extensions[i];
			IConfigurationElement[] ce = ext.getConfigurationElements();
			for (int j = 0; j < ce.length; j++) {
				IContributor contributor = ext.getContributor();
				String name = contributor.getName();
				if (P2_GC_PLUGIN_ID.equals(name)) {
					Object obj = ce[j].createExecutableExtension("run");
					app = (IApplication) obj;
					System.out.println("The garbage collector Extension has been found");
					break found;

		if (app == null) {
			System.out.println("Could not find P2 garbage collection application extension");
			throw new RuntimeException(
					"Could not find P2 garbage collection application extension.");
		} else {
			System.out.println("P2 Garbage Collector started Execution");
			System.out.println("P2 Garbage Collector finished Execution");


	private static IApplicationContext getP2AppContextForProfile(final String profileName) {
		return new IApplicationContext() {
			public Map<?,?> getArguments() {
				Map<String, Object> m = new HashMap<String, Object>();
				m.put(IApplicationContext.APPLICATION_ARGS, new String[] {"-profile", profileName});
				return m;


- Even after the implementation of the garbage collector and called it explicitly after each each delete operation, the bundle is not deleted. Still i see the bundle active. 

- The org.eclipse.update.configurator has been added to the runtime as well as the "reconcile" configuration run parameter is set to false. 

- As most of our bundles are root IUs. So the UpdateOperation is not working as well, i have read in the eclipse documentation the the IU if it is a root one, then it should be completely uninstalled from the system and installed again if i want to update it, and since the delete (uninstall) does not work so i am struggling with the update as well. 

My Questions: 
1- According to what i have done, is there a missing in the implementation to make the uninstall or delete really working? 

2- If the manifest of the bundle or IU has exported packages. that means other IUs depend on it. This IU can be uninstalled? if not, then how we can update it if the uninstall does not work? 

I would be very grateful if you can provide hints or help, 

Best Regards,

Back to the top