简体   繁体   中英

Standalone OSGi (Equinox) server on Eclipse Juno

I'm trying to get the osgi server from the Eclipse Juno Release and run it standalone. Some old tutorials say that just grabbing the org.eclipse.osgi_VERSION.jar is enough to start it from the command line as

java -jar  org.eclipse.osgi_VERSION.jar -console

When I try that, it doesn't show the prompt as expected, but instead sits quietly as if waiting for something to happen.

However, I can comfortably start and install bundles by doing a ./eclipse -console , which obviously isn't an option when running on the server, where I want to deploy bundles at runtime.

Some googling revealed I need to gather up jars (even Apache Felix's gogo) from here and there, but couldn't find anything concrete that would allow me to run this thing in a "headless" fashion.

Is there a way to do this in a clean and simple way, or would you suggest shifting to Apache Felix?

Equinox in Juno does no longer contain the console out of the box. It's now contained in a separate bundle which implements the Equinox console on top of the Apache GoGo shell.

Thus, the minimum setup of bundles for running Equinox including the console is:

  • org.eclipse.osgi
  • org.eclipse.equinox.console
  • org.apache.felifx.gogo.command
  • org.apache.felifx.gogo.runtime
  • org.apache.felifx.gogo.shell

For running the SSH console one also needs:

  • org.eclipse.equinox.console.ssh
  • org.apache.mina.core
  • org.apache.sshd.core

Additionally, you need to use a different configuration area . Equinox reads settings (like what bundles to use, their start levels, what application to start, etc.) from the config.ini. Thus, as along as you use the same configuration area as Juno you'll always end up in your Juno environment. You may corrupt your Juno installation when modifying the config.ini directly.

A better start is to download the Equinox Juno OSGi starter kit:

You can also try one of the OSGi Equinox server distributions:

Try this:

java -classpath ./plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar
    org.eclipse.equinox.launcher.Main -console

You should try Apache karaf. It can run with Felix or Equinox and contains everything you need for a decent OSGi server. See http://karaf.apache.org/

This link provides all the details regarding the new console which is based on Apache Felix Gogo shell: http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Fguide%2Fconsole_shell.htm

In short steps are:

  1. Place the necessary bundles in a folder. The bundles are: org.apache.felix.gogo.command_0.8.0v.jar org.apache.felix.gogo.runtime_0.8.0v.jar org.apache.felix.gogo.shell_0.8.0v.jar org.eclipse.equinox.console_1.0.0v.jar org.eclipse.osgi.jar

  2. Create a configuration subfolder and a config.ini file with the following content

    osgi.bundles=./org.apache.felix.gogo.runtime_0.8.0v.jar@start,\\ ./org.apache.felix.gogo.command_0.8.0v.jar@start,\\ ./org.apache.felix.gogo.shell_0.8.0v.jar@start,\\ ./org.eclipse.equinox.console.jar@start,\\ osgi.console.enable.builtin=false

  3. Start the Equinox framework with the below command: java -jar org.eclipse.osgi.jar

To run with the old console, you can invoke:

java -Dosgi.console.enable.builtin=true -jar org.eclipse.osgi_VERSION.jar -console

Note that this is using the old (non-Gogo implementation) and the built-in console is likely to be removed at some point. However, you should consider running with the Gogo shell instead, which is the de-facto standard for future Eclipse and Felix versions.

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