简体   繁体   中英

The magic behind “org.eclipse.equinox.ds@3:start”?

I have a standalone headless RCP with the following command line arguments.

Command-line arguments:  -os macosx -ws cocoa -arch x86_64 -clean -consoleLog 

I could successfully generate the binary to be run as a command line tool, but the issue is that I have to modify the config.ini file from

osgi.bundles=org.eclipse.equinox.common@2:start,
org.eclipse.update.configurator@3:start,
org.eclipse.equinox.ds@2:start,
org.eclipse.core.runtime@s

to

osgi.bundles=org.eclipse.equinox.common@2:start,
org.eclipse.update.configurator@3:start,
org.eclipse.equinox.ds@3:start, <---
org.eclipse.core.runtime@s

Without this change, I got these error messages when I execute the binary.

org.osgi.framework.BundleException: The bundle "org.eclipse.equinox.ds_1.4.0.v20120522-1841 [3]" could not be resolved. Reason: Missing Constraint: Import-Package: org.eclipse.equinox.internal.util.event; version="1.0.0"
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolverError(AbstractBundle.java:1332)
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolutionFailureException(AbstractBundle.java:1316)
    at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:323)

The magic behind "org.eclipse.equinox.ds@3:start"? Why it works well after my change? How can I setup in eclipse IDE so that I don't have to manually change the ini file all the time when I create the headless RCP.

I can explain the magic behind the change, but I unfortunately am not familiar with exporting applications from Eclipse.

osgi.bundles is a property that defines what bundles are available and when (eg at what start level ) they should they start. The platform loads and starts those bundles at level 1, then 2, and so on up until osgi.startLevel (by default is 6, described in the juno doc linked above).

In order to start org.eclipse.equinox.ds the platform needs to load a bundle that exports version 1.0.0 of the org.eclipse.equinox.internal.util.event package. From some searching this seems to be the org.eclipse.equinox.util bundle.

So by changing from @2 to @3 you're pushing the starting of the ds bundle to be later in the startup of the platform to a point after the util bundle is loaded. I suspect what is helping here is the org.eclipse.update.configurator bundle (as it's a bundle whose job is to load all the bundles from the plugins directory .)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM