Building Your Equinox OSGi Application Server – Part 2

In my previous post, I described how to easily build an Equinox-based web application server that can be run on any servlet container. Note that in the previous post I had these instructions for completing the export wizard dialog

d) The Generate metadata repository should be unchecked

If using p2 (as in this post), this is incorrect.  It should say

d) The Generate metadata repository should be checked (to include p2 metadata)

I’ve updated this documentation in the original posting.

Once your p2-enabled app server is running, you can do some really cool things with it.  For example, since p2 is available, you can dynamically install new components into your running application server.  Here’s the OSGi console help output (part of it anyway):


Notice the Provisioning Commands text.  These are console commands enabled by the presence of p2 that allow you to do common provisioning operations like installing new components.  In this blog entry, I’ll show how to install a version of the Knoplerfish httpconsole, but the same approach applies to software available from other p2 repositories.  In other posts, the EclipseSource team will show how to do this hot deployment into a running server for:

First, one must add the metadata and artifact repository URIs using the provaddrepo and provaddartifactrepo commands:


Notice the provlg command, which lists the p2 groups available in the newly added repositories (in this case, the Knopplerfish httpconsole v2.0.0).  Now, issue the provinstall command with the feature group and version… wait a few seconds and you should see the install complete message


Then issue the confapply command (this command applies the new bundle configuration to the currently running platform):


Now, you can see the new bundle installed via the short status (ss) command:


To start the httpconsole bundle (and activate the servlet that it runs) just type start 50.

At this point, you can open a web browser, and point it at your Equinox application server now running the httpconsole at http://localhost:8080/myappserver/console and magic…your application server is now running the Knoplerfish httpconsole servlet, which provides a web interface to the list of running bundles:


Just for fun, you can stop the httpconsole with stop 50 and the servlet will no longer respond


You can start it back up, and then the servlet will be running again. This makes a nice demo for people that have to manage the install and update of new components into a running application server. In future posts, I’ll show how to add features to your application server statically (during the build, rather than at runtime) as well as how to use ECF remote services to manage a running application server without having to use the OSGi console.


10 Responses to “Building Your Equinox OSGi Application Server – Part 2”

  1. Kim Moir says:

    Very interesting! Great post.

  2. Frederic says:

    What about provisioning thru Maven repos ?

  3. Scott Lewis says:

    Hi Frederic,

    I don’t plan to describe provisioning through Maven repos, as Maven isn’t an EclipseRT technology (and I’m focusing on EclipseRT technologies for this series). However, if you or others do a posting on it, I will be happy to link to it.

    Please just let me know.

  4. Udo says:

    Where do I get the knopflerfish repository from? How do I install it?

  5. Scott Lewis says:

    Hello Udo.

    RE: the knopflerfish repo…I got it from and created a repository myself after making small modifications to the httpconsole servlet. The modifications were necessary because in the existing servlet were several hard-coded URL paths, that did not work in a new context. I then created a repo using the p2 repo-creation tools. Since I am not on the knopflerfish team, I do not feel comfortable redistributing this code, although I would happily contribute the changes back to the knoplerfish team if they so desire.

  6. Santosh B says:

    knoplerfish rep details is missing and as you said in the previous comment changes in the existing servlet.

  7. Scott Lewis says:

    Hi Santosh. For the moment, I don’t feel comfortable redistributing the changes that I made to the knoplerfish servlet (just some absolute to relative path changes), because I haven’t gotten any approval for doing this from the knopplerfish folks. So for the moment, I’ll just direct you to to get the original knopflerfish code…and I will be happy to guide you through the necessary changes. And I will try to get a hold of the knoplerfish committers and offer to contribute the changes back.

  8. Tom France says:

    Is there a way to accomplish the same console-based provisioning steps using the p2 director application? That would allow for finer-grained control + uninstalls.

  9. Bill Nelson says:

    Excellent tutorial! Thank you. Quick question, is it necessary to run Equinox OSGi in a servlet container application? We have developed an application that simply moves files around using Spring Integration and we would prefer not using Spring dm, Tomcat, etc. Can it be done?

  10. Bojan Kraut says:

    Great article! Thanks.
    I guess you changed the code in Activator. Anyway if I just change absolute path to relative I get an exception when I try to start the bundle. Id be very gratefull if you can send me your corrections.

10 responses so far

Written by . Published in Categories: Planet Eclipse

Looking for a job?

Karlsruhe / Remote
Karlsruhe / Victoria / Remote
Karlsruhe / Victoria / Remote