Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » Can't run P2 director using EclipseStarter
Can't run P2 director using EclipseStarter [message #1734824] Mon, 13 June 2016 10:33 Go to next message
Ned Twigg is currently offline Ned TwiggFriend
Messages: 9
Registered: April 2013
Junior Member
I'm trying to run P2 director using EclipseStarter.

My code looks like this:

Map<String, String> map = new HashMap<>();
map.put(EclipseStarter.PROP_FRAMEWORK, "org.eclipse.osgi");
map.put(EclipseStarter.PROP_INSTALL_AREA, p2dir.getAbsolutePath());
map.put(EclipseStarter.PROP_CONSOLE_LOG, "true");
map.put(EclipseStarter.PROP_NOSHUTDOWN, "false");
map.put(EclipseStarter.PROP_BUNDLES, "org.eclipse.equinox.common@2:start, org.eclipse.update.configurator@3:start, org.eclipse.core.runtime@start");
map.put(EclipseStarter.PROP_FRAMEWORK, osgiJar.toURI().toString());
map.put("equinox.use.ds", "true");
EclipseStarter.setInitialProperties(map);
		
//EclipseStarter.run(argList.toArray(new String[0]), null);
EclipseStarter.run(new String[]{"-application", "org.eclipse.equinox.p2.director",
		"-clean",
		"-installIU", "org.eclipse.core.runtime",
		"-repository", "http://download.eclipse.org/eclipse/updates/4.6milestones/S-4.6RC4a-201606061100/"}, null);


But I get this error:
java.lang.NullPointerException: A null service reference is not allowed.
	at org.eclipse.osgi.internal.framework.BundleContextImpl.getService(BundleContextImpl.java:617)
	at org.eclipse.equinox.internal.p2.director.app.DirectorApplication.initializeServices(DirectorApplication.java:624)
	at org.eclipse.equinox.internal.p2.director.app.DirectorApplication.run(DirectorApplication.java:1099)
	at org.eclipse.equinox.internal.p2.director.app.DirectorApplication.start(DirectorApplication.java:1293)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)


Here are the lines of DirectorApplication in question
	private void initializeServices() throws CoreException { //TODO FAIRE QQCHE ICI POUR POSITIONNER p2 folder CORRECTEMENT
		BundleContext context = Activator.getContext();
		packageAdminRef = context.getServiceReference(PackageAdmin.class);
		packageAdmin = context.getService(packageAdminRef);
		ServiceReference<IProvisioningAgentProvider> agentProviderRef = context.getServiceReference(IProvisioningAgentProvider.class);
		IProvisioningAgentProvider provider = context.getService(agentProviderRef);


To debug, I tried to see what my bundles are like. Here is their full state (all are latest from Neon RC4).

org.eclipse.osgi = ACTIVE
org.eclipse.equinox.common = ACTIVE
org.eclipse.update.configurator = ACTIVE
org.eclipse.core.runtime = ACTIVE
org.apache.commons.codec = RESOLVED
org.apache.commons.logging = RESOLVED
org.apache.felix.gogo.command = ACTIVE
org.apache.felix.gogo.runtime = ACTIVE
org.apache.felix.gogo.shell = ACTIVE
org.apache.httpcomponents.httpclient = RESOLVED
org.apache.httpcomponents.httpcore = RESOLVED
org.eclipse.core.contenttype = ACTIVE
org.eclipse.core.jobs = ACTIVE
org.eclipse.ecf.filetransfer = STARTING
org.eclipse.ecf.identity = STARTING
org.eclipse.ecf.provider.filetransfer.httpclient4.ssl = RESOLVED
org.eclipse.ecf.provider.filetransfer.httpclient4 = STARTING
org.eclipse.ecf.provider.filetransfer.ssl = RESOLVED
org.eclipse.ecf.provider.filetransfer = STARTING
org.eclipse.ecf.ssl = RESOLVED
org.eclipse.ecf = STARTING
org.eclipse.equinox.app = ACTIVE
org.eclipse.equinox.concurrent = STARTING
org.eclipse.equinox.console = ACTIVE
org.eclipse.equinox.ds = RESOLVED
org.eclipse.equinox.frameworkadmin.equinox = STARTING
org.eclipse.equinox.frameworkadmin = STARTING
org.eclipse.equinox.p2.artifact.repository = STARTING
org.eclipse.equinox.p2.console = STARTING
org.eclipse.equinox.p2.core = STARTING
org.eclipse.equinox.p2.director.app = STARTING
org.eclipse.equinox.p2.director = STARTING
org.eclipse.equinox.p2.engine = STARTING
org.eclipse.equinox.p2.garbagecollector = STARTING
org.eclipse.equinox.p2.jarprocessor = RESOLVED
org.eclipse.equinox.p2.metadata.repository = STARTING
org.eclipse.equinox.p2.metadata = STARTING
org.eclipse.equinox.p2.operations = STARTING
org.eclipse.equinox.p2.repository = STARTING
org.eclipse.equinox.p2.touchpoint.eclipse = STARTING
org.eclipse.equinox.p2.touchpoint.natives = STARTING
org.eclipse.equinox.p2.transport.ecf = STARTING
org.eclipse.equinox.preferences = ACTIVE
org.eclipse.equinox.registry = ACTIVE
org.eclipse.equinox.security = STARTING
org.eclipse.equinox.simpleconfigurator.manipulator = STARTING
org.eclipse.equinox.simpleconfigurator = STARTING
org.eclipse.equinox.util = STARTING
org.eclipse.osgi.compatibility.state = RESOLVED
org.eclipse.osgi.services = RESOLVED
org.sat4j.core = RESOLVED
org.sat4j.pb = RESOLVED
org.tukaani.xz = RESOLVED


Question #1: Am I getting the error that I am getting because most of the p2 bundles are STARTING, when I'd expect them to be ACTIVE?
Question #2: How do I make them start?
Re: Can't run P2 director using EclipseStarter [message #1734935 is a reply to message #1734824] Mon, 13 June 2016 21:55 Go to previous message
Ned Twigg is currently offline Ned TwiggFriend
Messages: 9
Registered: April 2013
Junior Member
Figured it out. Needed to add "org.eclipse.equinox.ds" to EclipseStarter.PROP_BUNDLES, so that declarative services works correctly.
Previous Topic:Current Neon version seems to prevent JDKs JAX-WS implementation from working
Next Topic:process to reconciler dropins
Goto Forum:
  


Current Time: Thu Oct 10 04:56:02 GMT 2024

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

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

Back to the top