JBoss.orgCommunity Documentation

Chapter 2. Getting Started

2.1. Download the Distribution
2.2. Running the Installer
2.3. Starting the Runtime
2.4. Provided Examples
2.5. Bundle Deployment
2.6. Managing installed Bundles
2.7. Hudson QA Environment

This chapter takes you through the first steps of getting JBoss OSGi and provides the initial pointers to get up and running.

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

To run the installer execute the following command:

    java -jar jboss-osgi-installer-1.0.0.Beta8.jar

The installer first shows a welcome screen

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

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

In case you have selected 'JBossAS 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.

If you selected JBoss OSGi Runtime during installation you should see a runtime folder, which contains the JBoss OSGi Runtime distribution. The JBoss OSGi Runtime is an OSGi container onto which services and applications can be deployed.

The layout of the JBoss OSGi Runtime after installation is similar to what you know from JBossAS.

You can start the Runtime by running bin/run.sh. The supported command line options are:

  • -c (--server-name) - The runtime profile to start. The default is the 'default' profile.
  • -b (--bind-address) - The network address various services can bind to. The default is 'localhost'
$ bin/run.sh

  JBossOSGi Bootstrap Environment

  OSGI_HOME: /home/tdiesler/jboss-osgi-1.0.0.Beta8/runtime

  JAVA: /usr/java/jdk1.6/bin/java

  JAVA_OPTS: ...


11:45:05,168 INFO  JBossOSGi Framework Core - 1.0.0.Alpha5
11:45:05,826 INFO  Starting bundles for start level 1
11:45:06,677 INFO  Bundle STARTED: Bundle{system.bundle-0.0.0}
11:45:06,686 INFO  JBossOSGi Runtime booted in 1.515sec
11:45:06,703 INFO  Bundle INSTALLED: Bundle{jboss-osgi-common-core-2.2.13.GA}
11:45:06,925 INFO  Bundle STARTED: Bundle{jboss-osgi-common-core-2.2.13.GA}
11:45:07,177 INFO  Bundle STARTED: Bundle{org.apache.felix.eventadmin-1.2.2}
11:45:07,695 INFO  Bundle STARTED: Bundle{jboss-osgi-jndi-1.0.3}
11:45:07,916 INFO  Bundle STARTED: Bundle{org.apache.aries.jmx-0.1.0.incubating}
11:45:07,939 INFO  Bundle STARTED: Bundle{org.apache.aries.util-0.1.0.incubating}
11:45:08,217 INFO  Bundle STARTED: Bundle{jboss-osgi-jmx-1.0.7}
11:45:08,222 INFO  JBossOSGi Runtime started in 1.777sec

JBoss OSGi comes with a number of examples that you can build and deploy. Each example deployment is verified by an accompaning test case

Bundle deployment works, as you would probably expect, by dropping your OSGi Bundle into the JBoss OSGi Runtime deploy folder.

$ cp .../test-libs/example/example-http.jar .../runtime/server/web/deploy
13:59:38,284 INFO  [BundleRealDeployer] Installed: example-http [9]
13:59:38,289 INFO  [example-http] BundleEvent INSTALLED
13:59:38,297 INFO  [example-http] BundleEvent RESOLVED
13:59:38,304 INFO  [example-http] ServiceEvent REGISTERED
13:59:38,306 INFO  [BundleStartStopDeployer] Started: example-http [9]
13:59:38,306 INFO  [example-http] BundleEvent STARTED

JBoss OSGi comes with a simple Web Console, which is currently based on the Apache Felix Web Console project. The JBoss OSGi Web Console is included in the runtime profiles 'web' or 'all'. After startup you can point your browser to http://localhost:8090/jboss-osgi.

The Web Console can also be used to install, start, stop and uninstall bundles.

Setup the Hudson QA Environment

The JBoss OSGi Hudson QA Environment is an integral part of the JBoss OSGi 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 JBoss OSGi release that you currently work with.

If in future we should discover a problem with a previous JBoss OSGi 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 frameworks

Set Hudson Properties

You need to set a few properties

$ cd build/hudson
$ cp ant.properties.example ant.properties
$ vi ant.properties

# Tomcat settings

# SCM settings
# ------------

# JDK settings
# ------------

# Maven settings
# --------------

# The JBoss settings
# ------------------

# Hudson Default settings
# -----------------------
# hudson.root=/home/username/workspace/hudson/jboss-osgi
# hudson.admin=username
# hudson.version=1.355

# JBoss Distributions
# -------------------
# hudson.jboss600.zip=file:///home/username/Downloads/java/jboss/jboss-6.0.0.M3.zip
Run Hudson Setup
$ ant hudson-setup
Buildfile: build.xml

     [echo] hudson.root = /home/hudson/workspace/hudson/jboss-osgi
     [echo] hudson.home = /home/hudson/workspace/hudson/jboss-osgi/hudson-home


     [copy] Copying 2 files to /home/hudson/workspace/jboss-osgi/hudson-home
     [copy] Copying 13 files to /home/hudson/workspace/jboss-osgi/hudson-home/jobs
     [echo] *************************************
     [echo] * Hudson setup successfully          
     [echo] * sudo service tomcat6 restart       
     [echo] *************************************