Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 357801

Summary: Installing of equinox registry fails
Product: [RT] Virgo Reporter: Alex Blewitt <alex.blewitt>
Component: runtimeAssignee: Glyn Normington <glyn.normington>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: glyn.normington
Version: unspecified   
Target Milestone: 3.0.2.RELEASE   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on: 357804    
Bug Blocks:    

Description Alex Blewitt CLA 2011-09-15 09:44:46 EDT
Build Identifier: 3.0.1

Using Virgo 3.0.1 (jetty) I tried to install Equinox registry:

127     RESOLVED    org.eclipse.equinox.registry_3.5.100.v20110502

It doesn't have any missing dependencies (otherwise it would be installed) but when I try to start it, I see a NullPointerException which I don't get if I'm running out of standalone Equinox.

osgi> start 127
org.osgi.framework.BundleException: Exception in org.eclipse.core.internal.registry.osgi.Activator.s
tart() of bundle org.eclipse.equinox.registry.
        at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextIm
pl.java:734)
        at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:6
83)
        at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:381)
        at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:299)
        at org.apache.felix.gogo.command.Basic.start(Basic.java:758)
...
Caused by: java.lang.NullPointerException
        at org.eclipse.core.internal.runtime.ResourceTranslator.getResourceBundle(ResourceTranslator
.java:69)
        at org.eclipse.core.internal.runtime.ResourceTranslator.getResourceBundle(ResourceTranslator
.java:61)
        at org.eclipse.core.internal.registry.osgi.EclipseBundleListener.addBundle(EclipseBundleList
ener.java:177)

The code looks like this, with line 69 being the 'return' line:

		if (hasRuntime21(bundle)) {
			Locale locale = (language == null) ? Locale.getDefault() : new Locale(language);
			return ResourceBundle.getBundle("plugin", locale, createTempClassloader(bundle)); //$NON-NLS-1$
		}
		return Activator.getDefault().getLocalization(bundle, language);

The conclusion is that the getDefault() is returning null, which returns the static field 'singleton' as per standard Eclipse patterns. However, this is set up in the start method as follows:

	public void start(BundleContext context) throws Exception {
		RuntimeLog.setLogWriter(getPlatformWriter(context));
		bundleContext = context;
		singleton = this;

The getPlatformWriter() does some service access which Virgo might be intercepting. Would you know why this happens?

This bug is currently preventing the installation of the registry in Virgo, which in turn prevents ECF from being used :/

(having said that, this bug is almost certainly in the activator of the core runtime in any case).

Reproducible: Always

Steps to Reproduce:
1. Install org.eclipse.core.registry into Virgo
2. Start org.eclipse.core.registry
3. See NPE being generated
Comment 1 Alex Blewitt CLA 2011-09-15 09:56:46 EDT
Raised bug 357804 for runtime activator
Comment 2 Glyn Normington CLA 2011-09-26 11:34:36 EDT
This is an Equinox bug.
Comment 3 Glyn Normington CLA 2011-10-26 06:33:22 EDT
Virgo did have a bug after all. Fixed under bug 357804 - see this bug for details.