JBoss.orgCommunity Documentation
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.Beta9.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.
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:
$ bin/run.sh
=========================================================================
JBossOSGi Bootstrap Environment
OSGI_HOME: /home/tdiesler/jboss-osgi-1.0.0.Beta9/runtime
JAVA: /usr/java/jdk1.6/bin/java
JAVA_OPTS: ...
=========================================================================
12:27:07,406 INFO JBossOSGi Framework Core - 1.0.0.Alpha8
12:27:07,515 INFO Bundle STARTED: system.bundle:0.0.0
12:27:08,079 INFO Bundle STARTED: org.apache.felix.log:1.0.0
12:27:08,182 INFO Bundle STARTED: jboss-osgi-common:1.0.6
12:27:08,239 INFO Bundle STARTED: jboss-osgi-hotdeploy:1.0.8
12:27:08,244 INFO JBossOSGi Runtime booted in 0.837sec
12:27:08,459 INFO Bundle STARTED: org.apache.aries.util:0.1.0.incubating
12:27:08,608 INFO Bundle STARTED: org.apache.aries.jmx:0.1.0.incubating
12:27:08,690 INFO Bundle STARTED: org.apache.felix.configadmin:1.2.4
12:27:08,839 INFO Bundle STARTED: org.apache.felix.eventadmin:1.2.2
12:27:09,288 INFO Bundle STARTED: jboss-osgi-jndi:1.0.4
12:27:09,291 INFO Bundle STARTED: jboss-osgi-common-core:2.2.17.SP1
12:27:09,493 INFO Bundle STARTED: jboss-osgi-jmx:1.0.8
...
12:27:09,493 INFO JBossOSGi Runtime started in 1.264sec
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.
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
You need to set a few properties
$ cd build/hudson $ cp ant.properties.example ant.properties $ vi ant.properties # Tomcat settings tomcat.base=/usr/share/tomcat6 tomcat.conf=/etc/tomcat6/tomcat6.conf # SCM settings # ------------ scm.git.url.jbosgi=git://github.com/jbosgi/jbosgi.git scm.http.url.jbosgi=http://github.com/jbosgi/jbosgi # JDK settings # ------------ java.home.jdk15=/usr/java/jdk1.5.0_22 java.home.jdk16=/usr/java/jdk1.6.0_17 # Maven settings # -------------- maven.name=apache-maven-2.2.1 maven.path=/usr/java/apache-maven-2.2.1 # The JBoss settings # ------------------ jboss.server.instance=default jboss.bind.address=127.0.0.1 # 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.zipRun Hudson Setup
$ ant hudson-setup Buildfile: build.xml init-hudson: [echo] [echo] hudson.root = /home/hudson/workspace/hudson/jboss-osgi [echo] hudson.home = /home/hudson/workspace/hudson/jboss-osgi/hudson-home [echo] ... hudson-setup: [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] ************************************* [echo] * Hudson setup successfully [echo] * sudo service tomcat6 restart [echo] *************************************