0

In my local environment I use the "start.bat" file to start application bundle.

This is like as follows:

java -jar -ea -Declipse.ignoreApp=true -Dosgi.clean=true -Ddebug=true plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar -console -noExit

OSGi is starting on the command prompt by the way I can list existing plugins. However the production will be a saaj environment and I think to start OSGi as a background process by installing a process manager package. Then my question is how to monitor it? How to start or stop the bundles? Do I need to use some monitoring tools such as Apache Felix web console to be able to make telnet connection? Is there an easy way (or common usage) to do on a cloud server? Can someone inform me about this issue because I am new to OSGi concept?

Neil Bartlett
  • 23,743
  • 4
  • 44
  • 77
mahkras
  • 541
  • 4
  • 6

1 Answers1

0

After some further researches, I've found a solution for my situation. "-console" option of eclipse equinox (which is equivalent to "osgi.console") takes host and port parameters. So I 've changed my start script as follows(just added port number):

java -jar -ea -Declipse.ignoreApp=true -Dosgi.clean=true -Ddebug=true plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar -console 5555 -noExit

However this additional configuration needs some extra libraries and OSGi config changes. I had to place following jar files on the same folder with "org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar". That is the plugins folder in my environment.

  • org.apache.felix.gogo.command_0.10.0.v201209301215.jar
  • org.apache.felix.gogo.runtime_0.10.0.v201209301036.jar
  • org.apache.felix.gogo.shell_0.10.0.v201212101605.jar
  • org.eclipse.equinox.console_1.1.0.v20140131-1639.jar

Secondly I have configured my config.ini file. It should contain following key/values:

osgi.bundles=org.eclipse.equinox.console@start, org.apache.felix.gogo.command@start, org.apache.felix.gogo.shell@start, org.apache.felix.gogo.runtime@start
osgi.noShutdown=true
eclipse.ignoreApp=true

After these changes, I can pass commands to the OSGi runtime from the command line by simply using a telnet connection to the port given. A tricky point is OSGi is always up until you termşnate OSGi console by typing 'exit' even if you terminate your ssh connection.

Reference: OSGi Modularity - Tutorial

mahkras
  • 541
  • 4
  • 6
  • You should not use the telnet shell in a production environment because it is highly insecure: it will allow any hacker to run arbitrary code on your machine. Instead use the ssh facility provided by the Felix Gogo shell: https://stackoverflow.com/questions/30590137/apache-felix-shell-with-ssh#31037001 – Neil Bartlett Dec 27 '17 at 08:38