I've searched all around for some good sources, but either have been searching for the wrong keywords, or I'm just missing something. I'm looking to redevelop a web app I've been using for some time now. Many parts are out of date, and we're constantly throwing in little hacks to attempt to give it new life.

So what I'd like to do is re-engineer it from the ground up, built on some sort of plug-in framework. Before I continue, I'm more or less an intermediate Java programmer. In some ways, I'm hoping to use this project as a big learning experience.

I've read a lot about OSGi, and it seems that's the most complete framework. Ideally, I would like an end result web app which I can run one instance as my hosting environment, and other instances can connect to it to grab new and updated plug-ins. Eventually I'll want to lock down these plug-ins based on some undecided criteria of who can get them (basically some will simply be updates, others will provide new functionality and should be "purchased" through an external system). But that will probably be handled in a later phase. There should be an administration view for managing bundles in a hot environment (looking to avoid having to restart the server for an update).

I know all these things are possible, I'm just trying to find some good resources for reference. All the OSGi tutorials I'm finding seem to be too simplistic. If anyone here can guide me in the right direction on any or all of the items I'm looking for, it would be much appreciated. Also, this is my first post, so I'll take any comments/criticisms about the content of my post. Thanks!

  • Why do you want to use a plugin framework? How large/complex is the application?
    – greg
    Commented May 21, 2012 at 12:17

3 Answers 3


In OSGi there are a variety of available solutions for provisioning OSGi modules/plugins.

One of the approaches is the OSGi Bundle Repository (OBR). This is a system that can contain OSGi modules and serve as a provisioning system for your applications. It can be accessed from shell or an OBR Service API to resolve resources. It seems as a good foundation for a pluggable framework. You would need to have a central OBR which contains your plugins and an update module that uses the API to connect to it and resolve.

OBR is used in e.g. Bndtools for provision resources to Eclipse OSGi projects. Applications such as Artifactory and Nexus also provide support for OBR. More on OBR, OBR explained in OSGi In Action book.

As mentioned in the beginning there are other provisioning systems. Most runtimes (Eclipse Virgo, Apache Karaf) offer some sort of repository system (not always OBR) to provision bundles. They already have web applications available to view and interract with them. More on this in the answer given on this SO question. From OSGi R5 there are standardisation services for interacting with a lot of them. See these slides at eclipsecon.org about Subsystem Service, Repository Service and Resolver Service.

Finally I'd like to mention the Apache Sling project. It is a framework to build OSGi web applications but the interesting thing is that it uses the Java Content Repository specification to manage content. You can deploy Sling to any servlet container and it has a admin web application where you can manage OSGi bundles. It is fast to get up and running and try it out. You just have to deploy the Sling launchpad war. See more about Sling launchpad at sling.apache.org. I do not have much experience with developing with Sling, I have just used it to deploy OSGi web applications.

Basically, when using OSGi a plugin system is at your fingertips without implementing all of it yourself. Although it is hard to find real world examples I recommend using an existing provisioning system from an OSGi runtime or Sling to get your started quickly. A good resource are the Manning books on OSGi (OSGi In Action, In Depth & Enterprise) they helped me a lot in grasping the concepts and the examples are really good.


Any developer wants to create a killer application with a lot of features. But I learned from lean start-up methodology that you can take it easy. First create an application with minimal functionality, launch the first version of application and wait for feedback.

If your application has success and the code increases that it's clear that you CAN need a plugin framework to let another programmers to extend you application or for a better code organisation. In this step you choose a library that resolves your immediately needs that doesn't has a big learning curve.

What I want to say it's that it's good to think big but do it step by step.

In my applications I used a tiny java library PF4J created by me. No xml, only java code.

From my point of view OSGi is OK, it's a standard, it's powerful but it's too complex for small and medium application and for this reasons I don't recommend it for what you want to achieve.


I'm on a limited connection here, so will be short.

I'd strongly suggest you look at OSGi & Project Jigsaw going forwards. Also you might find success with JSR-330 (aka Dependency Injection for Java). Sonatype and others are using it as basis for a plugin framework on Hudson amongst other things. HTH a little and hopefully a more complete answer blows mine away :-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.