Skip to main content



      Home
Home » Eclipse Projects » Equinox » [p2] updateOperation returns null as ProvisioningPlan and ProvisioningJob
[p2] updateOperation returns null as ProvisioningPlan and ProvisioningJob [message #1690210] Wed, 25 March 2015 13:01 Go to next message
Eclipse UserFriend
Hello,

I was trying out a very basic self-update for an RCP application, but I'm really stuck.

In two words : when I try to resolve the updateOperation, both the getProvisioningPlan() and getProvisioningJob return null.

When I ask for the details of the resolving of the UpdateOperation, I get nothing more than the following message:
Quote:
Your original request has been modified. Unexpected error. Could not process the request. Check the error log for details.


I've already spent two afternoons just finding out how to retrieve this error log, not to speak about the rest Sad

My code (simplified) :
        static final String REPOSITORY_LOC = "file:///C:/data/buildtest/target/repository" ;
	private IProvisioningAgent agent ;
	private UpdateOperation operation ;
	private URI uri = null ;
	
	@Inject
	public UpdateManager(IProvisioningAgentProvider provider, LoggerFactory loggerFactory)
	{
		//...
                uri = new URI(REPOSITORY_LOC) ;
		agent = provider.createAgent(uri) ;
		//...
	}
	
	public void update(LifecycleRV rv) throws InterruptedException
	{	
		UpdateStatus preparationStatus = prepareUpdateJob() ;
		UpdateStatus finalStatus ;
                //...
		finalStatus = doUpdateJob() ;
               //...
	}
	
	private UpdateStatus prepareUpdateJob()
	{
		//...
		operation = initOperation() ;
		IStatus check = operation.resolveModal(null) ;
		
		logger.debug(String.format("updateOperation resolved with details : %s", operation.getResolutionDetails()));
		
		IProvisioningPlan plan = operation.getProvisioningPlan() ;
		if (plan == null)
			logger.error("Provisioningplan null") ;
		//...
	}
	
	private UpdateOperation initOperation()
	{		
		ProvisioningSession session = new ProvisioningSession(agent);
		UpdateOperation result = new UpdateOperation(session);		
		result.getProvisioningContext().setArtifactRepositories(new URI[] { uri });
	    result.getProvisioningContext().setMetadataRepositories(new URI[] { uri });
	    return result ;
	}
	
	private UpdateStatus doUpdateJob()
	{
		if (operation == null)
			return UpdateStatus.UPDATE_NOK ;
		ProvisioningJob job = operation.getProvisioningJob(null);
		
		if (job == null)
			return UpdateStatus.UPDATE_NOK;

		IStatus status = job.runModal(null) ;
                //...
}


The plugins manifest contains the following required bundles :
org.eclipse.equinox.p2.core;bundle-version="2.4.0",
org.eclipse.equinox.p2.engine;bundle-version="2.3.0",
org.eclipse.equinox.p2.metadata.repository;bundle-version="1.2.100",
org.eclipse.equinox.p2.operations;bundle-version="2.4.0"

The product file contains the following feature:
<feature id="org.eclipse.equinox.p2.core.feature" version="1.3.0.v20150126-1400"/>

I really have no idea how to make this work. Anybody any ideas ... ?

Thomas Elskens
Re: [p2] updateOperation returns null as ProvisioningPlan and ProvisioningJob [message #1690451 is a reply to message #1690210] Fri, 27 March 2015 07:23 Go to previous messageGo to next message
Eclipse UserFriend
Okay I think I've made some progress : instead of Injecting a IProvisioningAgentProvider and creating the Provisioning agent myself, I can inject the ProvisioningAgent directly, as follows :

@Inject
	public UpdateManager(IProvisioningAgent agent, LoggerFactory loggerFactory)
	{
		//...
                uri = new URI(REPOSITORY_LOC) ;
		final ProvisioningSession session = new ProvisioningSession(agent);
		//etc.
	}


This seems to work better, as the update job now seems to resolve normally.
However, when actually exectuing the updatejob, I now have another message (but still no means to retrieve the errorstack...) :

Quote:

An error occurred while unconfiguring the items to uninstall.


Anybody any idea what this might hint at ...?

Thomas Elskens
Re: [p2] updateOperation returns null as ProvisioningPlan and ProvisioningJob [message #1690475 is a reply to message #1690451] Fri, 27 March 2015 10:14 Go to previous message
Eclipse UserFriend
Solved, finally, after a week of research B-)

I poured some more information out of p2 using a little funciton :
private void printIStatus(IStatus status)
	{
		System.err.println() ;
		System.err.printf("UpdateStatus NOK : %s", status.getMessage()) ;
		System.err.println() ;
		if (status.getException() != null)
			System.err.printf("Error : %s", status.getException()) ;
		
		if (status.isMultiStatus())
		{
			for (int i = 0 ; i < status.getChildren().length ; ++i)
			{
				printIStatus(status.getChildren()[i]) ;
			}
		}
	}


This gave me an additionnal line of information : "Could not acquire the framework manipulator service"

Then I found the answer in this message (https://www.eclipse.org/forums/index.php?t=msg&th=809201&goto=1625799&#msg_1625799.


  1. Include org.eclipse.osgi.compatibility.state to the runtime
  2. Customize the startlevels of p2 bundles :
    <plugin id="org.eclipse.equinox.event" autoStart="true" startLevel="2" />
    <plugin id="org.eclipse.equinox.frameworkadmin" autoStart="true" startLevel="5" />
    <plugin id="org.eclipse.equinox.simpleconfigurator" autoStart="true" startLevel="1" />


Update is now working !

Thank you for listening Wink

Thomas Elskens
Previous Topic:Listing OSGi packages and which bundles they belong to
Next Topic: Convert any Equinox project to Apache Felix
Goto Forum:
  


Current Time: Mon Jul 07 11:06:08 EDT 2025

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

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

Back to the top