Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » P2 » Headless Updating Error
Headless Updating Error [message #568314] Thu, 12 August 2010 09:53 Go to next message
Simon  is currently offline Simon Friend
Messages: 6
Registered: August 2010
Junior Member
Hello,

I'm trying to add headless updating on my application. I use the code provided by the P2Util class in the project org.eclipse.equinox.p2.examples.rcp.prestartupdate. When I run the exported product, no problem. But when I run the application inside eclipse, a NullPointerException is thrown. I have the same issue why my project or with the org.eclipse.equinox.p2.examples.rcp.prestartupdate project.

Here is a piece of code from the P2Util class :

...
ProvisioningSession session = new ProvisioningSession(agent);

UpdateOperation operation = new UpdateOperation(session);
SubMonitor sub = SubMonitor.convert(monitor, "Checking for application updates...", 200);
IStatus status = operation.resolveModal(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) {

ProvisioningJob job = operation.getProvisioningJob(null);
status = job.runModal(sub.newChild(100));
if (status.getSeverity() == IStatus.CANCEL)
throw new OperationCanceledException();
}
...

The error occurs precisely here :
status = job.runModal(sub.newChild(100));

just after :
ProvisioningJob job = operation.getProvisioningJob(null);

P2 detects an update and wants the provisionning job to do it but the operation doesn't return any ProvisioningJob, it's null.

Can you explain me why?

Here is the stack trace :

java.lang.reflect.InvocationTargetException
at org.eclipse.jface.operation.ModalContext.runInCurrentThread( ModalContext.java:477)
at org.eclipse.jface.operation.ModalContext.run(ModalContext.ja va:372)
at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(Progress MonitorDialog.java:507)
at org.eclipse.equinox.p2.examples.rcp.prestartupdate.Applicati onWorkbenchWindowAdvisor.postWindowOpen(ApplicationWorkbench WindowAdvisor.java:94)
at org.eclipse.ui.internal.WorkbenchWindow.fireWindowOpened(Wor kbenchWindow.java:1332)
at org.eclipse.ui.internal.WorkbenchWindow.open(WorkbenchWindow .java:798)
at org.eclipse.ui.internal.Workbench$24.runWithException(Workbe nch.java:1234)
at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run (StartupThreading.java:31)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:3 5)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchr onizer.java:134)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.jav a:4041)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3660)
at org.eclipse.ui.application.WorkbenchAdvisor.openWindows(Work benchAdvisor.java:803)
at org.eclipse.ui.internal.Workbench$31.runWithException(Workbe nch.java:1566)
at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run (StartupThreading.java:31)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:3 5)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchr onizer.java:134)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.jav a:4041)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3660)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2537)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:24 27)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:670)
at org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:663)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
at org.eclipse.equinox.p2.examples.rcp.prestartupdate.Applicati on.start(Application.java:20)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:369)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 619)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
Caused by: java.lang.NullPointerException
at org.eclipse.equinox.p2.examples.rcp.prestartupdate.P2Util.ch eckForUpdates(P2Util.java:61)
at org.eclipse.equinox.p2.examples.rcp.prestartupdate.Applicati onWorkbenchWindowAdvisor$1.run(ApplicationWorkbenchWindowAdv isor.java:76)
at org.eclipse.jface.operation.ModalContext.runInCurrentThread( ModalContext.java:464)
... 38 more


Thanks,
Simon
Re: Headless Updating Error [message #1085787 is a reply to message #568314] Tue, 13 August 2013 11:23 Go to previous message
Boy D'Poy is currently offline Boy D'PoyFriend
Messages: 56
Registered: October 2011
Member
***!!! DO NOT RUN THE PROJECT WITHIN THE ECLIPSE IDE !!!***

(make an export before!)


Once You Go Scout, You Never Come Out!
Previous Topic:Ant task p2.composite.repository append flag
Next Topic:Bundle Qualifier Substitution
Goto Forum:
  


Current Time: Sat Nov 22 03:07:42 GMT 2014

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

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