Skip to main content

Virgo: the Ideal OSGi Server Runtime?

Virgo is an ideal OSGi server runtime, possibly the ideal OSGi server runtime, from several perspectives.

Standard OSGi

Virgo supports all the standard features of OSGi; encapsulated modules or bundles, a powerful service registry, versioning, class space isolation, sharing of dependencies, dynamic refreshing and updating, and much more.

Bundles all the way down

Virgo was designed from the ground up as OSGi bundles so it's extremely modular and extensible.

For example, the core of the runtime is the Virgo kernel which is built on the relatively tiny Virgo Nano runtime. Virgo Server for Apache Tomcat is constructed by configuring a web layer, an admin console, and some other utilities on top of the kernel. Similarly the Virgo Jetty Server is constructed by configuring a collection of Jetty bundles, the admin console, and other utilities on top of the kernel.

The kernel protects itself from interference from such additions, and from applications, by running them in a separate user region. The kernel and user region are isolated from each other using standard OSGi defined hooks with sharing controlled by a user region configuration file. This separation enables applications to use a different version of the Spring framework to that used by the kernel.

All the major Java EE application servers are now built on top of OSGi, but only Virgo was designed for OSGi and didn't need OSGi to be retrofitted.

Extra features

Virgo provides a multi-bundle application model to simplify the deployment and management of non-trivial applications.

Virgo also provides a repository which can store dependencies such as OSGi bundles which are "faulted in" when needed. This results in cleaner definitions of applications and a small footprint compared to traditional Java EE servers which pre-load many features just in case an application needs them.

The major Java EE application servers are beginning to follow suit in exposing an application model, so Virgo committers are working with others in the OSGi Alliance to produce a standard multi-bundle application construct.

Existing Java libraries

Virgo enables existing Java libraries to run successfully in an OSGi environment. Ok, you have to convert them to bundles first, but then the Virgo kernel supports thread context class loading, load time weaving, classpath scanning, and a number of other features which are commonly used by persistence providers and other common Java utilities.

Essentially, we observed the commonly-occurring problems when people attempted to migrate to OSGi and implemented general solutions to those problems early on.

Container integration

Virgo integrates OSGi with Spring and a servlet container.

Virgo uses Gemini Blueprint (formerly Spring DM) to wire application contexts to the OSGi service registry. Beans can be published as OSGi services and can consume OSGi services, both with minimal effort.

The embedded form of Apache Tomcat is used as a servlet engine in Virgo Server for Apache Tomcat web support and is configured and managed just like standard Apache Tomcat. Similarly, Jetty is the servlet engine in Virgo Jetty Server.


Virgo has extensive diagnostics:

  • An admin console lets you examine the state of all artifacts deployed in Virgo as well as explore the state of bundles in the OSGi framework.
  • Virgo provides multiple types of diagnostics: event logging aimed at administrators, diagnostics logging aimed at developers, as well as various types of diagnostic dumps.
  • Virgo builds on Logback to support highly configurable and efficient logging.
  • When an application is deployed, Virgo first resolves the application in a "side state" and, if resolution fails, no changes are committed to the OSGi framework and the side state is dumped to disk so that it can be analysed using the OSGi state inspector in the admin console.
  • If a resolution failure occurs, Virgo also analyses the resolver error, including the root causes of any uses constraint violation, and extracts a meaningful message to include in an exception which is then thrown.
  • Virgo adds advanced diagnostics to Spring DM to track the starting of bundles and their application contexts and issue error messages on failure and warnings when dependencies are delayed.
  • Virgo automatically detects deadlocks and generates a thread stack dump.

Advanced tooling

Virgo tooling support is provided in the SpringSource Tool Suite or in standard Eclipse via an update site. This enables a Virgo server to run under the control of the tooling, applications to be deployed, debugged, and updated by the tooling, and package and service dependencies between bundles to be analysed.

Future proof

Virgo is an open source Eclipse project with a liberal license and active participation from multiple vendors, which positions it ideally for the future.

Back to the top