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.

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.

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!
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.

In either event (Felix or Equinox), you can skip the manual installation step by adding the web console bundle URL to Pax Runner’s list of things to provision.
The simplest way to do that is just to add that URL to the end of the command line when you start Pax Runner. A better way is to probably put together a provisioning file, a custom profile, or a composite file for Pax Runner to load it from.
Hi Craig,
thanks for your comment! So to install the the web console in a single step, it’s possible to type
pax-run.sh –profiles=web http://www.internet.bs/apache.org/felix/org.apache.felix.webconsole-1.2.10.jar
or
pax-run.sh –profiles=web –platform=equinox http://www.internet.bs/apache.org/felix/org.apache.felix.webconsole-1.2.10.jar
I’ll talk about custom profiles in another post.
Thanks again!
Thanks for your post that showed how simple is to use the Felix WebConsole with the Equinox container.
I also tried and succeeded with an alternative and shorter provisioning:
pax-run.sh –profiles=felix.webconsole –platform=equinox
Thanks again.
Hi,
I have one question. Is that possible to use Felix with my Equinox container?
Thanks,
Ramanan
Hi, Felix is a OSGi container, so it’s an alternative to Equinox.
But if you are interested only in the Apache Felix Web Console, that’s available as a separate bundle. You can download it from http://apache.mirror.anlx.net/felix/org.apache.felix.webconsole-1.2.10.jar
Please note that if you don’t have an OSGi Http Service in your framework, you need to install one before starting the Web Console. You can use the Apache Felix Http Service to that purpose. You can download it from http://apache.mirror.anlx.net/felix/org.apache.felix.http.jetty-1.0.1.jar
Thank you very much for your reply.
As you said I just need Felix web console alone. I am already using Equinox. Its working perfectly.
Is there any other web console for OSGi other than Felix?
A very lightweight alternative is the Knopflerfish HTTP Console, you can download it at http://www.knopflerfish.org/repo/jars/httpconsole/httpconsole-2.0.1.jar
I’ll publish a little test-drive of this library next Thursday.
There are also some alternative desktop tools currently under development:
a VisualVM plugin at http://ordinaryjava.blogspot.com/2009/06/visualvm-osgi-plugin.html
and a VisualOSGi application at http://eppleton.sharedhost.de/blog/?p=893
Thank you very much.
This is really good and useful post for me. Awaiting for next Thursday.