Monitor your OSGi container with the Apache Felix Web Console

Every OSGi container comes with a handy textual console, but if you aren’t (yet!) an hardcore OSGi geek, there’s a very nice web interface that can help you to inspect and manage your OSGi framework. Its name is Apache Felix Web Management Console.

Apache Felix Web Console

The Felix Web Console is a single OSGi bundle that runs in any OSGi container, provided that you have an OSGi HttpService installed. It allows you to see the installed bundles, start/stop them, install and uninstall bundles and much more. Furthermore, its extensible architecture allows developers to add new pages and functionalities.

Let’s see how we can quickly install and try it using Pax Runner.

Let’s start with Apache Felix. The first step is to start the OSGi container using the pax web profile (have a look at this post for more informations on Pax Runner):

pax-run.sh --profiles=web
    ______  ________  __  __
   / __  / /  __   / / / / /
  /  ___/ /  __   / _\ \ _/
 /  /    /  / /  / / _\ \
/__/    /__/ /__/ /_/ /_/

Pax Runner (1.1.1) from OPS4J - http://www.ops4j.org
----------------------------------------------------

 -> Using config [classpath:META-INF/runner.properties]
 -> Using only arguments from command line
 -> Scan bundles from [scan-composite:mvn:org.ops4j.pax.runner.profiles/web//composite]
 -> Scan bundles from [scan-composite:mvn:org.ops4j.pax.runner.profiles/log//composite]
 -> Scan bundles from [scan-bundle:mvn:org.ops4j.pax.logging/pax-logging-api/1.3.0]
 -> Scan bundles from [scan-bundle:mvn:org.ops4j.pax.logging/pax-logging-service/1.3.0]
 -> Scan bundles from [scan-bundle:mvn:org.ops4j.pax.web/pax-web-service/0.6.0]
Provision bundle [mvn:org.ops4j.pax.logging/pax-logging-api/1.3.0, at default start level, bundle will be started, bundle will be loaded from the cache]
 -> Provision bundle [mvn:org.ops4j.pax.logging/pax-logging-service/1.3.0, at default start level, bundle will be started, bundle will be loaded from the cache]
 -> Provision bundle [mvn:org.ops4j.pax.web/pax-web-service/0.6.0, at default start level, bundle will be started, bundle will be loaded from the cache]
 -> Preparing framework [Felix 1.8.1]
 -> Downloading bundles...
 -> Felix 1.8.1 : 368237 bytes @ [ 140kBps ]
 -> org.osgi.compendium (4.1.0) : 514214 bytes @ [ 264kBps ]
 -> org.apache.felix.shell (1.2.0) : 59114 bytes @ [ 5374kBps ]
 -> org.apache.felix.shell.tui.plugin (1.2.0) : 12455 bytes @ [ 296kBps ]
 -> mvn:org.ops4j.pax.logging/pax-logging-api/1.3.0 : 86184 bytes @ [ 310kBps ]
 -> mvn:org.ops4j.pax.logging/pax-logging-service/1.3.0 : 426219 bytes @ [ 303kBps ]
 -> mvn:org.ops4j.pax.web/pax-web-service/0.6.0 : 968964 bytes @ [ 23633kBps ]
 -> Using execution environment [J2SE-1.6]
 -> Runner has successfully finished his job!

Welcome to Felix.
=================
.. [a lot of logs here]
 -> ps

START LEVEL 6
   ID   State         Level  Name
[   0] [Active     ] [    0] System Bundle (1.8.1)
[   1] [Active     ] [    5] OPS4J Pax Logging - API (1.3.0)
[   2] [Active     ] [    5] OPS4J Pax Logging - Service (1.3.0)
[   3] [Active     ] [    5] OPS4J Pax Web - Service (0.6.0)
[   4] [Active     ] [    1] osgi.compendium (4.1.0.build-200702212030)
[   5] [Active     ] [    1] Apache Felix Shell Service (1.2.0)
[   6] [Active     ] [    1] Apache Felix Shell TUI (1.2.0)
 -> 

Felix has started, and as you can see typing the ps command, several bundles are preinstalled; among them you can see the Pax Web Service, that implements the OSGi Http Service.

Now let’s install the Web Console. Simply type

 -> install http://www.internet.bs/apache.org/felix/org.apache.felix.webconsole-1.2.10.jar
Bundle ID: 7
start 7

Done! Now you can open your browser at http://localhost:8080/system/console, enter the admin/admin username and password, and enjoy your web console.

Apache Felix Web Console

As you can see, there are several pages in the Web Console, but not all of them are working out of the box, as you have to install additional bundles. For instance, to be able to work with the Configuration page, you’ll need to install a Configuration Admin Service implementation, and so forth.

After you’ve played a bit with console, you may want to try it with your favorite OSGi framework (assuming it’s not Felix!). Equinox user? Simply type

pax-run.sh --profiles=web --platform=equinox

and then, when the console appears, type again

 -> install http://www.internet.bs/apache.org/felix/org.apache.felix.webconsole-1.2.10.jar
Bundle ID: 6
 -> start 6

and you are now ready to try the Web Console on Equinox!

osgi

If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.

Comments

10 Responses to “Monitor your OSGi container with the Apache Felix Web Console”

Leave Comment

(required)

(required)