Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » P2 "Headless Updating on Startup" not working
P2 "Headless Updating on Startup" not working [message #128821] Wed, 08 April 2009 09:37 Go to next message
Andre Hanika is currently offline Andre HanikaFriend
Messages: 6
Registered: July 2009
Junior Member
Hi Devs
I am trying to make the P2 "Headless Updating on Startup" run.
I started with "Equinox p2 Getting Started for Developers" to get into the
subject.
Then I checked out the examples org.eclipse.equinox.p2.examples.rcp.cloud
and org.eclipse.equinox.p2.examples.rcp.prestartupdate which I could build
and run successfully.
Then I was trying to reproduce manually the single steps to get to what
the buildScript from the
org.eclipse.equinox.p2.examples.rcp.prestartupdate.releng is doing.

My Steps are:
1.) Create the RCPMail application
2.) Add the corresponding p2 bundles
3.) Create a product configuration
4.) Export the product (creates folder:test/MailDemo) with metadata
(creates folder:test/repository)
5.) Used the director app to create an installable version (creates
folder:test/install)
6.) I changed the config.ini file (in folder:test/install, the correct
place?) as described on the bottom of the page
http://wiki.eclipse.org/Equinox/p2/Adding_Self-Update_to_an_ RCP_Application
7.) When I start the application from the test/install folder, it checks
via the P2Util for any updates. This works fine, and nothing is updated.

Now I would like to update the version of the RCPMail application.
My Steps are:
1.) Change the version of the RCPMail product to 1.0.1 (was 1.0.0)
2.) Change the version of the RCPMail plugin.xml to 1.0.1 (was 1.0.0)
3.) Export product with metadata into same location as mentioned above.

When I start the application again from the test/install folder, the
P2Utils recognizes that a new version of the RCPMail plugin is available
(I debugged the P2Util.checkForUpdates method) and the method exits with
no errors. Now the application is restarted and the P2Util is invoked
again and finds again the same plugins to update and restarts again ....
and here I have a loop where the application tries to update, restart,
update, restart and so on and so forth.

My Questions are:
Is my manually deploy and update mechanism correct?
Where is the best place to breakpoint for if new versions are downloaded?
Did I miss something?

Thanks for any help,
André
Re: P2 "Headless Updating on Startup" not working [message #128834 is a reply to message #128821] Wed, 08 April 2009 12:32 Go to previous messageGo to next message
Andre Hanika is currently offline Andre HanikaFriend
Messages: 6
Registered: July 2009
Junior Member
Hi All
After some more debugging the P2Util class
( http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.equinox /p2/examples/org.eclipse.equinox.p2.examples.rcp.prestartupd ate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/P 2Util.java?root=RT_Project&view=markup)
I saw that the ArrayList replacementIUs is just filled with IUs, but then
never used again.
Is this a Bug that iusWithUpdates is used in the remove and the add method?
changeRequest.removeInstallableUnits(...iusWithUpdates...);
changeRequest.addInstallableUnits(...iusWithUpdates...);

Changed to:
changeRequest.removeInstallableUnits(...iusWithUpdates...);
changeRequest.addInstallableUnits(...replacementIUs...);

After I changed that, the new version of my RCPMail plugin was loaded
after a manually restart. But now the checkForUpdates method returns with
an error:


Status ERROR: org.eclipse.equinox.p2.engine code=4
An error occurred while collecting items to be installed null children=
[Status ERROR: org.eclipse.equinox.p2.engine code=0
session context was:(profile=profile, phase=, operand=, action=).
null Status ERROR: org.eclipse.equinox.p2.artifact.repository code=0
Problems downloading artifact:
osgi.bundle,org.eclipse.equinox.p2.exemplarysetup,1.0.0.2009 04081327.
null children=[Status OK: org.eclipse.equinox.p2.repository code=0 OK null
Status OK: org.eclipse.core.runtime code=0
OK null Status ERROR: org.eclipse.equinox.p2.artifact.repository code=0
Error while processing stream. MD5 hash is not as expected.
Expected: 2e5e5405cf57113a1f292083fb194e12 and found
b8af3ce9230b5d3f744129214510720a.
null Status OK: org.eclipse.core.runtime code=0 OK null Status OK:
org.eclipse.core.runtime code=0 OK null]]

Thanks for any help,
Andre
Re: P2 "Headless Updating on Startup" not working [message #129033 is a reply to message #128834] Mon, 13 April 2009 23:57 Go to previous messageGo to next message
Susan F. McCourt is currently offline Susan F. McCourtFriend
Messages: 16
Registered: July 2009
Junior Member
Andre Hanika wrote:
> Hi All
> After some more debugging the P2Util class
> ( http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.equinox /p2/examples/org.eclipse.equinox.p2.examples.rcp.prestartupd ate/src/org/eclipse/equinox/p2/examples/rcp/prestartupdate/P 2Util.java?root=RT_Project&view=markup)
> I saw that the ArrayList replacementIUs is just filled with IUs, but
> then never used again.
> Is this a Bug that iusWithUpdates is used in the remove and the add method?
> changeRequest.removeInstallableUnits(...iusWithUpdates...);
> changeRequest.addInstallableUnits(...iusWithUpdates...);

Yes, thanks for pointing that out. I've updated the example. I
remember fixing that once before, but apparently did not commit it. ;-(

>
> Changed to:
> changeRequest.removeInstallableUnits(...iusWithUpdates...);
> changeRequest.addInstallableUnits(...replacementIUs...);
>
> After I changed that, the new version of my RCPMail plugin was loaded
> after a manually restart. But now the checkForUpdates method returns
> with an error:
>
>
> Status ERROR: org.eclipse.equinox.p2.engine code=4 An error occurred
> while collecting items to be installed null children=
> [Status ERROR: org.eclipse.equinox.p2.engine code=0 session context
> was:(profile=profile, phase=, operand=, action=). null Status ERROR:
> org.eclipse.equinox.p2.artifact.repository code=0 Problems downloading
> artifact:
> osgi.bundle,org.eclipse.equinox.p2.exemplarysetup,1.0.0.2009 04081327.
> null children=[Status OK: org.eclipse.equinox.p2.repository code=0 OK
> null Status OK: org.eclipse.core.runtime code=0 OK null Status ERROR:
> org.eclipse.equinox.p2.artifact.repository code=0 Error while processing
> stream. MD5 hash is not as expected. Expected:
> 2e5e5405cf57113a1f292083fb194e12 and found
> b8af3ce9230b5d3f744129214510720a. null Status OK:
> org.eclipse.core.runtime code=0 OK null Status OK:
> org.eclipse.core.runtime code=0 OK null]]
>
> Thanks for any help,
> Andre

I'm not sure about this one. It's looking for a specific underlying p2
bundle that you built.

First of all - I am assuming that you updated the p2.inf file when you
built the app to point to the repository that you generated with export.
You'll want to make sure that both the artifact and metadata repo for
the build repo are included (type 0 and type 1).

addRepository(type:0,location:<your location>
addRepository(type:1,location:<your location>

The default repo in the p2.inf is a sample repo that is likely out of
date. If you've done that, then it sounds like a problem in the repo
that was built, and I'm not sure about that one.
Re: P2 "Headless Updating on Startup" not working [message #129068 is a reply to message #129033] Tue, 14 April 2009 15:47 Go to previous messageGo to next message
Andre Hanika is currently offline Andre HanikaFriend
Messages: 6
Registered: July 2009
Junior Member
Hi Susan,
After adding "org.eclipse.equinox.p2.touchpoint.natives" and
"org.eclipse.equinox.p2.repository" to prestartupdate.product I could make
it run somehow.
Thanks for your help
Re: P2 "Headless Updating on Startup" not working [message #129094 is a reply to message #129068] Tue, 14 April 2009 16:34 Go to previous messageGo to next message
Susan F. McCourt is currently offline Susan F. McCourtFriend
Messages: 16
Registered: July 2009
Junior Member
Andre Hanika wrote:
> Hi Susan,
> After adding "org.eclipse.equinox.p2.touchpoint.natives" and
> "org.eclipse.equinox.p2.repository" to prestartupdate.product I could
> make it run somehow. Thanks for your help
>

I see....some of the p2 bundles were refactored since the example was
created. org.eclipse.equinox.p2.repository is a new bundle. I'll try
to make some time to go over the examples and update them...thanks for
sharing your findings.

susan
Re: P2 "Headless Updating on Startup" not working [message #536719 is a reply to message #128821] Sun, 30 May 2010 09:39 Go to previous messageGo to next message
Vincenzo Caselli is currently offline Vincenzo CaselliFriend
Messages: 51
Registered: July 2009
Member
Hi Susan,
I checked out the latest (May 30, 2010)
org.eclipse.equinox.p2.examples.rcp.prestartupdate
so, according to bug
https://bugs.eclipse.org/bugs/show_bug.cgi?id=282333
I should have the fixed version.
Then, in order to try the headless update, I do the following:
- change the p2.inf content making it point to a local repository (e.g. file:///E:/Temp/RCPMail/repository)
- export the procuct into directory E:/Temp/RCPMail (so that repository corresponds to that of p2.inf)
- move the E:/Temp/RCPMail/eclipse product to another folder (let's call it the "deploy" folder)
- run prestartupdate.exe from the deploy folder: I receive the popup message "No updates available", that's ok
- change something in the sources (e.g. a menu item label)
- increase the version of both plugin.xml and prestartupdate.product (e.g. to "1.0.1.qualifier")
- re-export the product
- re-run the deployed product, what I obtain is:
* not receiving any popup (which indicates that the update is being correctly recognized I suppose)
* the product does not restart as expected, so no modification is shown
* the new plugin 1.0.1 is not present into
<deploy>\eclipse\plugins (the plugin was not retrieved)
* the .log shows the following
!SESSION 2010-05-30 11:19:04.111 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.6.0_18
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=it_IT
Command-line arguments:  -os win32 -ws win32 -arch x86

!ENTRY org.eclipse.equinox.p2.engine 4 4 2010-05-30 11:19:07.746
!MESSAGE An error occurred while collecting items to be installed
!SUBENTRY 1 org.eclipse.equinox.p2.engine 4 0 2010-05-30 11:19:07.746
!MESSAGE session context was:(profile=profile, phase=org.eclipse.equinox.internal.p2.engine.phases.Collect, operand=, action=).
!SUBENTRY 1 org.eclipse.equinox.p2.repository 4 1002 2010-05-30 11:19:07.746
!MESSAGE Unable to read repository at file:/E:/Temp/RCPMail/repository/plugins/org.eclipse.equinox.p2.examples.rcp.prestartupdate_1.0.1.201005301117.jar.
!STACK 0
org.eclipse.swt.SWTException: Invalid thread access
	at org.eclipse.swt.SWT.error(SWT.java:4083)
	at org.eclipse.swt.SWT.error(SWT.java:3998)
	at org.eclipse.swt.SWT.error(SWT.java:3969)
	at org.eclipse.swt.widgets.Widget.error(Widget.java:468)
	at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:359)
	at org.eclipse.swt.widgets.Control.internal_new_GC(Control.java:1540)
	at org.eclipse.swt.graphics.GC.<init>(GC.java:166)
	at org.eclipse.swt.graphics.GC.<init>(GC.java:132)
	at org.eclipse.jface.dialogs.Dialog.shortenText(Dialog.java:349)
	at org.eclipse.jface.dialogs.ProgressMonitorDialog$ProgressMonitor.subTask(ProgressMonitorDialog.java:234)
	at org.eclipse.core.runtime.SubMonitor$RootInfo.subTask(SubMonitor.java:280)
	at org.eclipse.core.runtime.SubMonitor.subTask(SubMonitor.java:578)
	at org.eclipse.core.runtime.ProgressMonitorWrapper.subTask(ProgressMonitorWrapper.java:156)
	at org.eclipse.core.runtime.SubProgressMonitor.subTask(SubProgressMonitor.java:174)
	at org.eclipse.core.runtime.SubMonitor$RootInfo.subTask(SubMonitor.java:280)
	at org.eclipse.core.runtime.SubMonitor.subTask(SubMonitor.java:578)
	at org.eclipse.equinox.internal.p2.repository.FileReader.handleTransferEvent(FileReader.java:180)
	at org.eclipse.ecf.provider.filetransfer.retrieve.AbstractRetrieveFileTransfer.fireTransferReceiveDataEvent(AbstractRetrieveFileTransfer.java:376)
	at org.eclipse.ecf.provider.filetransfer.retrieve.AbstractRetrieveFileTransfer.handleReceivedData(AbstractRetrieveFileTransfer.java:276)
	at org.eclipse.ecf.provider.filetransfer.retrieve.AbstractRetrieveFileTransfer$1.performFileTransfer(AbstractRetrieveFileTransfer.java:161)
	at org.eclipse.ecf.filetransfer.FileTransferJob.run(FileTransferJob.java:74)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
!SUBENTRY 1 org.eclipse.equinox.p2.repository 4 1002 2010-05-30 11:19:07.746
!MESSAGE Unable to read repository at file:/E:/Temp/RCPMail/repository/binary/org.eclipse.equinox.p2.examples.rcp.prestartupdate.product_root.win32.win32.x86_1.0.1.201005301117.
!STACK 0
org.eclipse.swt.SWTException: Invalid thread access
	at org.eclipse.swt.SWT.error(SWT.java:4083)
	at org.eclipse.swt.SWT.error(SWT.java:3998)
	at org.eclipse.swt.SWT.error(SWT.java:3969)
	at org.eclipse.swt.widgets.Widget.error(Widget.java:468)
	at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:359)
	at org.eclipse.swt.widgets.Control.internal_new_GC(Control.java:1540)
	at org.eclipse.swt.graphics.GC.<init>(GC.java:166)
	at org.eclipse.swt.graphics.GC.<init>(GC.java:132)
	at org.eclipse.jface.dialogs.Dialog.shortenText(Dialog.java:349)
	at org.eclipse.jface.dialogs.ProgressMonitorDialog$ProgressMonitor.subTask(ProgressMonitorDialog.java:234)
	at org.eclipse.core.runtime.SubMonitor$RootInfo.subTask(SubMonitor.java:280)
	at org.eclipse.core.runtime.SubMonitor.subTask(SubMonitor.java:578)
	at org.eclipse.core.runtime.ProgressMonitorWrapper.subTask(ProgressMonitorWrapper.java:156)
	at org.eclipse.core.runtime.SubProgressMonitor.subTask(SubProgressMonitor.java:174)
	at org.eclipse.core.runtime.SubMonitor$RootInfo.subTask(SubMonitor.java:280)
	at org.eclipse.core.runtime.SubMonitor.subTask(SubMonitor.java:578)
	at org.eclipse.equinox.internal.p2.repository.FileReader.handleTransferEvent(FileReader.java:180)
	at org.eclipse.ecf.provider.filetransfer.retrieve.AbstractRetrieveFileTransfer.fireTransferReceiveDataEvent(AbstractRetrieveFileTransfer.java:376)
	at org.eclipse.ecf.provider.filetransfer.retrieve.AbstractRetrieveFileTransfer.handleReceivedData(AbstractRetrieveFileTransfer.java:276)
	at org.eclipse.ecf.provider.filetransfer.retrieve.AbstractRetrieveFileTransfer$1.performFileTransfer(AbstractRetrieveFileTransfer.java:161)
	at org.eclipse.ecf.filetransfer.FileTransferJob.run(FileTransferJob.java:74)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

what I do wrong?
Consider that in my various trials I also modified P2Util in this way, from this (line 49)
(I tried to make the operation non-modal, please consider mine just as a trial)
IStatus status = operation.resolveModal(sub.newChild(100));

to
//IStatus status = operation.resolveModal(sub.newChild(100));
		ProvisioningJob job = operation.getResolveJob(monitor);
		IStatus status = job.run(sub.newChild(100));
		if (status.getCode() == UpdateOperation.STATUS_NOTHING_TO_UPDATE) {
			return status;
		}
		if (status.getSeverity() == IStatus.CANCEL)
			throw new OperationCanceledException();
		
//		if (status.getSeverity() != IStatus.ERROR) {
//			// More complex status handling might include showing the user what updates
//			// are available if there are multiples, differentiating patches vs. updates, etc.
//			// In this example, we simply update as suggested by the operation.
//			ProvisioningJob job = operation.getProvisioningJob(null);
//			status = job.runModal(sub.newChild(100));
//			if (status.getSeverity() == IStatus.CANCEL)
//				throw new OperationCanceledException();
//		}

this way I get no Invalid thread access exception and the product restarts in case the repository contains a new version. However the restarted product does not have the modification and the plugin folder does not contain the new plugin.
Seems like the new plugin is recognized, but fails to retrieve it.
Any suggestions?

Re: P2 "Headless Updating on Startup" not working [message #536788 is a reply to message #536719] Sun, 30 May 2010 23:54 Go to previous messageGo to next message
Vincenzo Caselli is currently offline Vincenzo CaselliFriend
Messages: 51
Registered: July 2009
Member
The problem is tighty related to this
http://www.eclipse.org/forums/index.php?t=msg&goto=53678 7&#msg_536787
Re: P2 "Headless Updating on Startup" not working [message #537318 is a reply to message #128821] Tue, 01 June 2010 23:27 Go to previous messageGo to next message
Vincenzo Caselli is currently offline Vincenzo CaselliFriend
Messages: 51
Registered: July 2009
Member
Hi all,
I managed the example to work!
I modified the code in ApplicationWorkbenchWindowAdvisor.postWindowOpen() in the following way:

- executed the ProgressMonitorDialog in the UI thread
before
try {
			new ProgressMonitorDialog(null).run(true, true, runnable);
		} catch (InvocationTargetException e) {
			e.printStackTrace();
		} catch (InterruptedException e) {
		}

after
Display.getDefault().asyncExec(new Runnable() {
			public void run() {
				try {
					new ProgressMonitorDialog(null).run(true, true, runnable);
				} catch (Throwable x) {
					LogHelper.log(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
							"Throwable 2: "+x));
				}
			}
		});


- same for restarting

before
PlatformUI.getWorkbench().restart();


after
Display.getDefault().asyncExec(new Runnable() {
						public void run() {
							try {
								PlatformUI.getWorkbench().restart();
							} catch (Throwable x) {
								LogHelper.log(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
										"Throwable 1: "+x));
							}
						}
					});


it just works!

Bye

Vincenzo Caselli
RCP Vision
Re: P2 "Headless Updating on Startup" not working [message #550226 is a reply to message #537318] Thu, 29 July 2010 14:51 Go to previous messageGo to next message
Suganya Devi is currently offline Suganya DeviFriend
Messages: 21
Registered: July 2009
Junior Member
Hi Vincenzo Caselli,
I have the same problem, it complains 'unable to read reposiory at...' and invalid thread access. I tried everything you have suggested. It doesn't seem to work Sad .

Can you pls. share your prestart update project?
Re: P2 "Headless Updating on Startup" not working [message #554012 is a reply to message #550226] Thu, 19 August 2010 16:41 Go to previous messageGo to next message
Suganya Devi is currently offline Suganya DeviFriend
Messages: 21
Registered: July 2009
Junior Member
My problem was solved by using a Null Progress monitor. Thank you Susan.

I have raised a bug in Eclipse https://bugs.eclipse.org/bugs/show_bug.cgi?id=321350 which is moved to 3.7 M2.
Re: P2 "Headless Updating on Startup" not working [message #654991 is a reply to message #128821] Thu, 17 February 2011 21:50 Go to previous message
Erik Langenbach is currently offline Erik LangenbachFriend
Messages: 1
Registered: February 2011
Junior Member
Thank you all. This thread provided the solution I needed to get the prestartupdate example working.

While working on this, I noticed different error-reporting behavior based on whether I referenced my repository in p2.inf with http:// or file:///. In short, I was not seeing any errors at all when using http:// even though the update was obviously failing...it was failing silently.

I have submitted a bug on this with detailed steps of my experience: https://bugs.eclipse.org/bugs/show_bug.cgi?id=337491
Previous Topic:Event Admin service reference is null when debugging in eclipse, not in command line
Next Topic:Broken links to 3.6.2 downloads
Goto Forum:
  


Current Time: Fri Apr 19 20:35:18 GMT 2024

Powered by FUDForum. Page generated in 0.04219 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top