Friday, March 27, 2009

JBossOSGi - Getting Started

This is the first of a the current series of three blogs on JBossOSGi
  1. Getting Started
  2. Service Provider Interface
  3. Provided Services
Installing JBossOSGi

JBossOSGi is distributed as an IzPack installer archive. The installer is available from the JBossOSGi download area.

To run the installer execute the following command:
 java -jar jboss-osgi-installer-1.0.0.Alpha3.jar
The installer first shows a welcome screen

Then you select the installation path for the JBossOSGi distribution. This is the directory where you find the binary build artifacts, the java sources, documentation and the JBossOSGi Runtime.

The installer contains multiple installation packs. Greyed packs are required, others are optional and can be deselected.

  • JBossOSGi Distribution - Documentation, Binary Artifacts and Sources
  • JBossOSGi Runtime - Standalone JBossOSGi Runtime based on JBossAS
  • JBossOSGi Integration - Integration with an existing JBossAS instance

In case you have selected 'JBossOSGi Integration', you will be presented with the choice of supported target containers.

You will then have to point the installer to your existing JBossAS installation.

You can then verify the selected installation options and proceed with the actual installation.

The installer reports its installation progress and finally displays a confirmation screen. You can now optionally generate an "automatic installation script" that you can use when you want to repeat what you have just done without user interaction.

JBossOSGi Runtime

If you selected 'JBossOSGi Runtime' during installation you should see a runtime folder, which contains the JBossOSGi Runtime distribution.

The JBossOSGi Runtime is a customized version of the JBoss Application Server. From that we removed the services that are not absolutely necessary to run the installed OSGi Framework. Consequently, you can start the JBossOSGi Runtime in the same way as you start JBossAS.

[tdiesler@tdvaio runtime]$ bin/
JBoss Bootstrap Environment
JBOSS_HOME: /usr/java/jboss-osgi-1.0.0.Alpha3/runtime
[ServerImpl] Starting JBoss (Microcontainer)...
[FelixIntegration] OSGi Integration Felix - 1.0.0.Alpha3
[FelixIntegration] Installed bundle: org.osgi.compendium
[FelixIntegration] Installed bundle: org.jboss.osgi.service.logging
[FelixIntegration] Started bundle: org.osgi.compendium
[FelixIntegration] Started bundle: org.jboss.osgi.service.logging
[OSGiDeployer] Installed: jboss-osgi-service-webconsole [3][INSTALLED]
[OSGiDeployer] Installed: org.apache.felix.bundlerepository [4][INSTALLED]
[OSGiDeployer] Installed: org.apache.felix.configadmin [5][INSTALLED]
[OSGiDeployer] Installed: org.apache.felix.http.jetty [6][INSTALLED]
[OSGiDeployer] Installed: org.apache.felix.log [7][INSTALLED]
[OSGiDeployer] Installed: org.apache.felix.metatype [8][INSTALLED]
[ServerImpl] JBoss (Microcontainer) [5.0.1.GA] Started in 11s:645ms
Bundle Deployment

Bundle deployment works, as you would probably expect, by dropping your OSGi Bundle into the JBossOSGi Runtime deploy folder.
cp .../test-libs/jbosgi36-bundle.jar .../server/default/deploy

[OSGiDeployer] Installed: jbosgi36 [9][INSTALLED]
[jbosgi36] BundleEvent INSTALLED
[jbosgi36] BundleEvent RESOLVED
[jbosgi36] ServiceEvent REGISTERED
[jbosgi36] BundleEvent STARTED
[BundleStartStopDeployer] Started: jbosgi36 [9][ACTIVE]
Managing installed Bundles

JBossOSGi comes with a simple Web Console, which is currently based on the Apache Felix Web Console project. By default the JBossOSGi Web Console is available at

Hudson QA Environment

Setup the Hudson QA Environment

The JBossOSGi Hudson QA Environment is an integral part of the JBossOSGi code base. It is designed for simplicity because we believe that comprehensive QA will only get done if it is dead simple to do so.

Consequently, you only have to execute two simple ant targets to setup the QA environment that was used to QA the JBossOSGi release that you currently work with.

If in future we should discover a problem with a previous JBossOSGi release, it will be possible to provide a patch and verify that change using the original QA environment for that release.

With every release we test the matrix of supported target containers and JDKs.

Set Hudson Properties

You need to set a few properties, especially these

  • hudson.maven.path
  • hudson.username
  • hudson.password
  • hudson.root
Run Hudson Setup
[tdiesler@tdvaio hudson]$ ant hudson-setup

[copy] Copying 2 files to /home/.../hudson/jboss-osgi/apache-tomcat
[echo] *************************************
[echo] * Hudson setup successfully *
[echo] * ant hudson-start *
[echo] *************************************
Run Hudson Start
[tdiesler@tdvaio hudson]$ ant hudson-start

[echo] *************************************
[echo] * Hudson started successfully *
[echo] * http://localhost:8280/hudson *
[echo] *************************************
Run Hudson Stop
[tdiesler@tdvaio hudson]$ ant hudson-stop

[echo] *************************************
[echo] * Hudson stopped successfully *
[echo] * ant hudson-start *
[echo] *************************************

What is there to come?

The intention of this blog post was to provide folks with the information to get started with JBossOSGi.

In my next post I'm going to write about the JBossOSGi Service Provider Interface - stay tuned.

No comments:

Post a Comment