Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » P2 » Updating Eclipse E4 project fails through p2
Updating Eclipse E4 project fails through p2 [message #1043053] Wed, 17 April 2013 03:57 Go to next message
Lakhveer Singh is currently offline Lakhveer Singh
Messages: 26
Registered: March 2013
Junior Member
hello guys,
please help me out here!

i m working on eclipse e4 project. in its menu bar i have added an menu item Update in help menu bar assigned an handler to it which contains the code for checking the update code for application, but when i clicks on the menu item it doesn't responds,
my products configuration is based on plugin.

here is the code of that handler

public class P2UpdateHandler {
private static final String REPOSITORY_LOC = "file:///c:/tmp/repository";

@Execute
public void execute(final IProvisioningAgent agent, final Shell parent,
final UISynchronize sync) {

Job j = new Job("Update Job") {
@Override
protected IStatus run(final IProgressMonitor monitor) {

/* 1. prepare update plumbing */
final ProvisioningSession session = new ProvisioningSession(agent);
final UpdateOperation operation = new UpdateOperation(session);

// create uri
URI uri = null;
try
{
uri = new URI(REPOSITORY_LOC);
}
catch (URISyntaxException e)
{
return Status.CANCEL_STATUS;
}

// set location of artifact and metadata repo
operation.getProvisioningContext().setArtifactRepositories(new URI[] { uri });
operation.getProvisioningContext().setMetadataRepositories(new URI[] { uri });

/* 2. check for updates */

// run update checks causing I/O
final IStatus status = operation.resolveModal(monitor);

// Failed to find updates (inform user and exit)
if (status.getCode() == UpdateOperation.STATUS_NOTHING_TO_UPDATE)
{
sync.syncExec(new Runnable()
{
@Override
public void run()
{
MessageDialog
.openWarning(parent, "No update",
"No updates for the current installation have been found");
}
});
return Status.CANCEL_STATUS;
}

/* 3. install updates (causing I/0!) */
try
{
operation.getProvisioningJob(monitor).schedule();
}
catch(final NullPointerException ex)
{
sync.syncExec(new Runnable()
{
@Override
public void run()
{
System.out.println(ex);
MessageDialog
.openWarning(parent, "Null Pointer",
"null pointer exception");
}
});
}
// Optionally register a job change listener to track
// installation progress and notify user upon success
return Status.OK_STATUS;
}
};
j.schedule();
}
}

i m getting a null pointer exception @ operation.getProvisioningJob(monitor).schedule();

so please help me out here!

thanks in advance


Re: Updating Eclipse E4 project fails through p2 [message #1043831 is a reply to message #1043053] Thu, 18 April 2013 03:08 Go to previous messageGo to next message
zhou jiyang is currently offline zhou jiyang
Messages: 1
Registered: April 2013
Junior Member
I have the same problem. Following...
Re: Updating Eclipse E4 project fails through p2 [message #1045567 is a reply to message #1043831] Sat, 20 April 2013 09:27 Go to previous messageGo to next message
Lakhveer Singh is currently offline Lakhveer Singh
Messages: 26
Registered: March 2013
Junior Member
please to this tutorial http://www.ralfebert.de/blog/eclipsercp/p2_updates_tutorial_36/

i had gone through this tutorial, its working for rcp developement and eclipse e4 project.

please try it!
Re: Updating Eclipse E4 project fails through p2 [message #1050517 is a reply to message #1045567] Sat, 27 April 2013 05:36 Go to previous message
Lakhveer Singh is currently offline Lakhveer Singh
Messages: 26
Registered: March 2013
Junior Member
hello guys, help me out,

i m working on eclipse e4 application and trying to update the application, i followed the http://www.ralfebert.de/blog/eclipsercp/p2_updates_tutorial_36/ for updating my application, my application is working properly if i m updating application from local machine, but when i m trying to update the application from a web repository or from web server created on local machine its gives me an exception in log file. below is the content of log file that i get after firing the event for application update.


!SESSION 2013-04-27 14:28:26.914 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.7.0_17
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
Framework arguments: -clearPersistedState
Command-line arguments: -os win32 -ws win32 -arch x86 -clearPersistedState

!ENTRY org.eclipselabs.p2.rcpupdate.utils 4 0 2013-04-27 14:28:33.959
!MESSAGE
!STACK 0
java.lang.reflect.InvocationTargetException
at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:421)
at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:507)
at org.eclipselabs.p2.rcpupdate.utils.P2Util.checkForUpdates(P2Util.java:34)
at com.wicked.demo.update.app.handlers.UpdateHandler.execute(UpdateHandler.java:10)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56)
at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:231)
at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:212)
at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:131)
at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:171)
at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.executeItem(HandledContributionItem.java:831)
at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.handleWidgetSelection(HandledContributionItem.java:724)
at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.access$7(HandledContributionItem.java:708)
at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem$4.handleEvent(HandledContributionItem.java:647)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4169)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3758)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1053)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:942)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:86)
at org.eclipse.e4.ui.internal.workbench.swt.E4Application.start(E4Application.java:150)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.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(EclipseStarter.java:353)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
Caused by: java.lang.NullPointerException
at org.eclipse.equinox.internal.p2.repository.helpers.AbstractRepositoryManager.loadIndexFile(AbstractRepositoryManager.java:721)
at org.eclipse.equinox.internal.p2.repository.helpers.AbstractRepositoryManager.loadRepository(AbstractRepositoryManager.java:640)
at org.eclipse.equinox.internal.p2.metadata.repository.MetadataRepositoryManager.loadRepository(MetadataRepositoryManager.java:96)
at org.eclipse.equinox.internal.p2.metadata.repository.MetadataRepositoryManager.loadRepository(MetadataRepositoryManager.java:92)
at org.eclipse.equinox.p2.engine.ProvisioningContext.loadMetadataRepository(ProvisioningContext.java:211)
at org.eclipse.equinox.p2.engine.ProvisioningContext.getLoadedMetadataRepositories(ProvisioningContext.java:194)
at org.eclipse.equinox.p2.engine.ProvisioningContext.getMetadata(ProvisioningContext.java:275)
at org.eclipse.equinox.internal.p2.director.SimplePlanner.updatesFor(SimplePlanner.java:777)
at org.eclipse.equinox.p2.operations.UpdateOperation.updatesFor(UpdateOperation.java:143)
at org.eclipse.equinox.p2.operations.UpdateOperation.computeProfileChangeRequest(UpdateOperation.java:180)
at org.eclipse.equinox.p2.operations.UpdateOperation$1.run(UpdateOperation.java:324)
at org.eclipse.equinox.internal.p2.operations.SearchForUpdatesResolutionJob.runModal(SearchForUpdatesResolutionJob.java:37)
at org.eclipse.equinox.p2.operations.ProfileChangeOperation.resolveModal(ProfileChangeOperation.java:115)
at org.eclipselabs.p2.rcpupdate.utils.P2Util.checkForUpdates(P2Util.java:84)
at org.eclipselabs.p2.rcpupdate.utils.P2Util.doCheckForUpdates(P2Util.java:63)
at org.eclipselabs.p2.rcpupdate.utils.P2Util.access$0(P2Util.java:52)
at org.eclipselabs.p2.rcpupdate.utils.P2Util$1.run(P2Util.java:39)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
Root exception:
java.lang.NullPointerException
at org.eclipse.equinox.internal.p2.repository.helpers.AbstractRepositoryManager.loadIndexFile(AbstractRepositoryManager.java:721)
at org.eclipse.equinox.internal.p2.repository.helpers.AbstractRepositoryManager.loadRepository(AbstractRepositoryManager.java:640)
at org.eclipse.equinox.internal.p2.metadata.repository.MetadataRepositoryManager.loadRepository(MetadataRepositoryManager.java:96)
at org.eclipse.equinox.internal.p2.metadata.repository.MetadataRepositoryManager.loadRepository(MetadataRepositoryManager.java:92)
at org.eclipse.equinox.p2.engine.ProvisioningContext.loadMetadataRepository(ProvisioningContext.java:211)
at org.eclipse.equinox.p2.engine.ProvisioningContext.getLoadedMetadataRepositories(ProvisioningContext.java:194)
at org.eclipse.equinox.p2.engine.ProvisioningContext.getMetadata(ProvisioningContext.java:275)
at org.eclipse.equinox.internal.p2.director.SimplePlanner.updatesFor(SimplePlanner.java:777)
at org.eclipse.equinox.p2.operations.UpdateOperation.updatesFor(UpdateOperation.java:143)
at org.eclipse.equinox.p2.operations.UpdateOperation.computeProfileChangeRequest(UpdateOperation.java:180)
at org.eclipse.equinox.p2.operations.UpdateOperation$1.run(UpdateOperation.java:324)
at org.eclipse.equinox.internal.p2.operations.SearchForUpdatesResolutionJob.runModal(SearchForUpdatesResolutionJob.java:37)
at org.eclipse.equinox.p2.operations.ProfileChangeOperation.resolveModal(ProfileChangeOperation.java:115)
at org.eclipselabs.p2.rcpupdate.utils.P2Util.checkForUpdates(P2Util.java:84)
at org.eclipselabs.p2.rcpupdate.utils.P2Util.doCheckForUpdates(P2Util.java:63)
at org.eclipselabs.p2.rcpupdate.utils.P2Util.access$0(P2Util.java:52)
at org.eclipselabs.p2.rcpupdate.utils.P2Util$1.run(P2Util.java:39)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)

Previous Topic:content.xml vs. artifacts.xml
Next Topic:Error installing repository from command line using director application
Goto Forum:
  


Current Time: Tue Jul 22 11:37:57 EDT 2014

Powered by FUDForum. Page generated in 0.04311 seconds