Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-core-dev] Ask for example about starting eclipse's osgi

hello,

@com.mabo.foo:
I tried to get the program running and finally find the problem. Tough I have a
further problem with it.

First  to get the FooPlugin running you refer to the org.eclipse.core.runtime.jar which
is on itself a plugin. This must also be installed like BUNDLE_URL. For me under linux
it looks like:

    private static final String BUNDLE_URL1 = "file:///home/martin/plugins/FooPlugin_1.0.0.jar";
    private static final String BUNDLE_URL2 = "file:///opt/eclipse_31M6_gtk/plugins/org.eclipse.core.runtime_3.1.0.jar";

    private void installBundle() {
        try {
            context.installBundle(BUNDLE_URL1);
            context.installBundle(BUNDLE_URL2);
        } catch (BundleException e) {
            System.err.println("Error during installing...");
            e.printStackTrace();
        }
    }

Now you can try to start() the bundle and your sys.outs will appear.

The issue: If you try to start() the eclipse.core.runtime you will get an exception, which is incomprensible to me:

org.osgi.framework.BundleException: Exception in org.eclipse.core.internal.runtime.PlatformActivator.start() of bundle org.eclipse.core.runtime.
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:1013)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:969)
	at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:321)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:266)
	at FooStarter.startBundles(FooStarter.java:154)
	at FooStarter.start(FooStarter.java:75)
	at FooStarter.main(FooStarter.java:166)
Caused by: java.lang.NullPointerException
	at org.eclipse.core.internal.runtime.InternalPlatform.getSplashHandler(InternalPlatform.java:653)
	at org.eclipse.core.internal.runtime.InternalPlatform.start(InternalPlatform.java:1075)
	at org.eclipse.core.internal.runtime.PlatformActivator.startInternalPlatform(PlatformActivator.java:141)
	at org.eclipse.core.internal.runtime.PlatformActivator.start(PlatformActivator.java:57)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl$2.run(BundleContextImpl.java:994)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:988)
	... 6 more

Maybe you know why this one comes up.

The thing I didn't like in this example program is, that you try to call the lower level osgi core, which inhibits me from making use of the 
extension-point-mechanism of the eclipse-runtime. Therefore I tried to work with the EclipseStarter.startup(...) to bootstrap the 
eclipse-runtime this way. But I got out with the all-known exception, which seems to be a problem with the JVM:

 Exception in thread "main" java.lang.Error: factory already defined
	at java.net.URL.setURLStreamHandlerFactory(URL.java:1074)
	at org.eclipse.osgi.framework.internal.core.Framework.initialize(Framework.java:184)
	at org.eclipse.osgi.framework.internal.core.Framework.<init>(Framework.java:104)
	at org.eclipse.osgi.framework.internal.core.OSGi.createFramework(OSGi.java:90)
	at org.eclipse.osgi.framework.internal.core.OSGi.<init>(OSGi.java:31)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.startup(EclipseStarter.java:272)
	at FooStarter.<init>(FooStarter.java:55)
	at FooStarter.main(FooStarter.java:165)

Now my question:
How can I reach a standalone or servlet bootstrapping of the eclipse-runtime without getting into troubles??? Does anybody
has an idea on resolving this problem?

martin


Back to the top