0

Let's say I have this OSGI Equinox application and that I'd like to know bundles are loaded, as well as their state. To do that, I thought about running the console, but I am not sure how to do that.

The application has the following folder structure:

workspace/
config/
features/
bundles/

The config/ directory contains both a config.ini file as well as error log files and some folders named with plugins' symbolic names.

I've tried running from the main(home) folder

java -jar bundles/org.eclipse.osgi_3.6.0.v20100517.jar -console -consoleLog

but all I get is a

osgi> !SESSION 2013-06-04 08:57:53.023 ----------------------------------------------- eclipse.buildId=unknown java.version=1.7.0_17 java.vendor=Oracle Corporation BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US Command-line arguments: -console -consoleLog

!ENTRY org.eclipse.osgi 4 0 2013-06-04 08:57:53.512 !MESSAGE Application error !STACK 1 java.lang.IllegalStateException: Unable to acquire application service. Ensure that the org.eclipse.core.runtime bundle is resolved and started (see config.ini). at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:74) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179) at org.eclipse.core.runtime.adaptor.EclipseStarter.main(EclipseStarter.java:150)

which raises the question of knowing where should the config.ini file be. As stated, I know there's one at config/, and while I know this RCP application uses that file as its config file, I am not too sure the same can be said of the console I've launched. Why? Because I've added the following line to bundles/config.ini no avail:

osgi.bundles=\
org.eclipse.core.runtime@5:start \
org.bountycastle@3:start, \
org.jdom@3:start, \
org.eclipse.equinox.event@3:start, \
org.eclipse.update.configurator@2:start, \
org.eclipse.equinox.common@2:start, \
org.eclipse.equinox.ds@4:start, \
org.eclipse.equinox.util@4:start, \
org.eclipse.core.runtime@start


osgi.startLevel=10
osgi.bundles.defaultStartLevel=5

Any cues are welcome. Thanks in advance.

devoured elysium
  • 101,373
  • 131
  • 340
  • 557

2 Answers2

2

If you are working with plain OSGi (and not with eclipse application) you should add the following to your config.ini:

eclipse.ignoreApp=true
osgi.noShutdown=true

Also, if you are not sure which config.ini is used, you may explicitly define the path by providing cmd arg:

java -jar .... -configuration <location of config.ini>
Alex Turbin
  • 2,554
  • 2
  • 22
  • 35
1

Based on the rest of the config.ini, I see that you actually start org.eclipse.core.runtime twice: one time @5:start and one time with (again) runlevel 5 based on the default start level.

Can you try to remove the last org.eclipse.core.runtime@start and change the first to runlevel 1? (org.eclipse.core.runtime@1:start) (maybe runlevel 2 would also work).

This way, you make sure the core.runtime is started first.

ljgw
  • 2,751
  • 1
  • 20
  • 39