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");
// String[0]), null); String[]{"-application", "org.eclipse.equinox.p2.director",
		"-installIU", "org.eclipse.core.runtime",
		"-repository", ""}, null);

But I get this error:
java.lang.NullPointerException: A null service reference is not allowed.
	at org.eclipse.osgi.internal.framework.BundleContextImpl.getService(

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 = ACTIVE
org.apache.httpcomponents.httpclient = RESOLVED
org.apache.httpcomponents.httpcore = RESOLVED
org.eclipse.core.contenttype = ACTIVE = 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 = 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 = 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 = STARTING
org.eclipse.equinox.simpleconfigurator.manipulator = STARTING
org.eclipse.equinox.simpleconfigurator = STARTING
org.eclipse.equinox.util = STARTING
org.eclipse.osgi.compatibility.state = RESOLVED = 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: Tue Mar 20 10:17:28 GMT 2018

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

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