Thursday 31 March 2011

Get OSGi samples running on your machine in 10 minutes

I've seen a few blogs that show how to get Apache Geronimo up and running, followed by how to install the Apache Aries Blog sample to use the neat OSGi functionality. However, that's typically where it stops!  So this post will hopefully be the end to end tutorial for a developer wanting to play with OSGi from scratch in about 10 minutes.

Let's start from scratch... We're going to Install the Apache Aries Blog sample on Apache Geronimo.  Not sure how many people already want to google 'Apache Aries' or 'Apache Geronimo', so I'll explain...

Apache Aries

Apache Aries is a set of Java components that can be added to an existing OSGi framework, such as equinox or felix, to provide an OSGi developer with Enterprise functionality, which a typical EE developer would be used to, such as JNDI, JPA, Transactions etc. To read more on Apache Aries, visit

Apache Geronimo

The Apache Geronimo project produces an application server runtime that uses other open source components to create a rich application environment.  It provides application containers for Java EE applications and OSGi applications (via Apache Felix). One of the open source components it contains is Apache Aries. For more information about Geronimo, check out the project website

So our picture of Geronimo so far is as follows:

Our OSGi bundles essentially run in the Apache Felix framework.  However with the Apache Aries functionality that sits alongside the Felix framework, they are able to connect with some of the typical JEE functionality as well as use other OSGi application features.

You'll need a Java runtime installed on your machine (Make sure the JAVA_HOME and JRE_HOME system variables are set), but I assume you all mostly have this already.  So start your stopwatches... Download Geronimo v3.0 M1, as this has the Apache Aries functionality, from you'll want one of the drivers from the "Non-Certified Web Container Releases" section.  You can choose which web container you wish to use, I chose Tomcat. 

Once your download (65MB ish) is complete, gunzip and extract your tar to an appropriate location on linux or just unzip somewhere in windows.  Your Geronimo server is ready to go! Simple as that (hopefully).  To start your server, go to the "geronimo-tomcat7-javaee6-3.0-M1/bin" directory or equivalent and type "./geronimo run". (Ensure you have root privileges)

You should see this screen:

Don't get too excited yet though, as it processes a little more before you should start playing. Wait till you get to this screen:

Right, at this stage our Geronimo Application server is up and running as you can see from the last line of output. Hit enter to get a prompt back.  We can see from this output that we have a few app modules installed including an EAR, a couple of RARs and some WAR files.  Let's now install our own OSGi application.

We need to install a datasource for the application, so firstly, download a rar file that is used to install the datasource here. This will be included in Geronimo in future versions.  Next download the actual data source descriptor here. Once those files have been downloaded, put them in the root directory of your extracted Geronimo server.  From a new command prompt, navigate to the geronimo rooot directory and run the following command, with the server running, to install the datasource:

./bin/deploy -u system -p manager deploy tranql-connector-derby-embed-xa-1.6.rar aries-datasource.xml
We're now ready to install the application.  Download the Apache Aries application binary from  I downloaded the Blog JPA app. Click the 'eba' link to download.  With the .eba file in the root Geronimo directory, run the following command, again whilst the server is running:

./bin/deploy -u system -p manager deploy
To view the blog sample, point your browser to http://localhost:8080/blog.  You should see the following:

Well, you've now got a running Geronimo server and Apache Aries Blog Sample running on your machine in (hopefully) about 10 minutes.  Feel free to have a play around with this sample - It's not massively interesting but is fit for purpose :o)  

Lets now look under the hood in the runtime :o)  From the Geronimo console, type 'list'.  This returns the full list of bundles in the Geronimo framework, including system bundles.  Quite a few, aren't there!  At the end you'll see the blog bundles we just installed:

What we see above is a quite a bit of info on each bundle we have in the environment.  Lets take the first bundle in the highlighted list and look at it in more detail. Important columns to mention are id, state and description columns. The first element is the bundle id.  This is a unique number given to every bundle in the framework so that we can use the number in commands, like stopping and starting a bundle.  The next element is the state of the bundle.  'Active' means the bundle has been started and can fully interact with other bundles.  The description column at the end is how to visually see which bundle is which.

So, now you can play :o)  hitting <tab> gets you a list of commands you can call from a geronimo prompt.  Commands of interest from an OSGi perspective include headers, list, refresh, restart, start, stop, update, exports and imports.  You can get more info about these commands by typing '--help' after the command, although they're all pretty straight forward.

Given this is quite a long post already, I'm going to leave it there :o) Well done for those that got this far!! I'll follow up very soon with a blog post which really plays around with the bundles and pulls apart the blog sample.

Please let me know how you got on (comment or tweet @sjmaple)

Wednesday 30 March 2011

WebSphere User Group, Bedfont, UK

Last week was the WebSphere User Group UK event held at Bedfont, UK.  I helped to organise this with a group of other people on the WUG board.  I'm pleased to say it was a great success and the sessions went down very well indeed among the 200-250 attendees

If you'd like to see some of the foils, they will be uploaded here shortly.

This year marked the 10th year of the UK WUG since Alan Chambers created the group back in 2001. We celebrated with an amazing cake, made for us by Cath at  I know she did amazing cakes as she made our wedding cake!

I'm pleased to say that there were a good number of developers from Hursley attending, which allowed us to set up a helpdesk like stand where we had some great discussions with customers and we were able to show live demos on some of our new OSGi functionality in the WAS v8.0 beta.

Feedback from our WUG members was very good. In general the timetable and quality of sessions and speakers was Excellent/Very good on feedback forms. The day ended with a meet the experts panel with many great minds up on stage:  (half the panel, pictured left to right - Andy Piper, Ian Robinson, Alasdair Nottingham, Leigh Williamson)

If you're interested in WAS and haven't been to a WUG event before, I would strongly reccommend you attend.  Meeting people and talking to others using WAS and IBMers between sessions are often as valuable as the sessions themselves! :o)

How OSGi can be dynamic

A new video is now available at the Enterprise OSGi YouTube channel. In this new video, Valentin Mahrwald goes through the effects that removing a bundle in an OSGi environment can have in a dynamic OSGi framework.

The new video can be seen here

Monday 14 March 2011

The Enterprise OSGi YouTube channel is a big hit!

We've had some great responses from our new Enterprise OSGi channel.  Notably the channel has had over 650 hits, and over 20 subscribers in under a week!  I've still got a number of videos going through various stages of editing, some on WebSphere Application Server, some on the core OSGi technologies.

Why not look at our latest video on the WAS v8.0 Beta, March refresh, which I blogged about earlier today.

One of the responses I got was regarding video contributions from non-IBMers.  I think this would be a great idea to build up an Enterprise OSGi community for us all to share knowledge and information through.  If you would like to contribute to the channel, please get in contact with me, either via this blog or twitter @sjmaple and we can work on new content for the channel.

Going forward, it'd be good to make the channel more technology focused rather than product based. (I'll put up the already recorded and edited WAS videos, which are already in the pipeline).  Videos should be around 5 minutes in length and could include concepts, best practices or experiences of Enterprise OSGi.

Thanks for your support, and I look forward to working with you to make this channel a success!

WebSphere Application Server v8.0 Beta, March refresh

IBM have released a WAS v8.0 Beta refresh which includes some great new OSGi Applications functionality, including: In-place application update, a feature that allows administrators to manage and migrate their OSGi bundles at runtime, without application restart. Application extensions allow administrators to extend their applications at runtime with a Composite Bundle Archive (CBA), again with no application restart. There are also performance monitoring, security, session management, servlet 3.0 support for OSGi applications/components.

To download the WAS v8.0 Beta and get playing with all the new features, visit the download site here ->

Tuesday 8 March 2011

Introducing the new Enterprise OSGi YouTube channel.

Over the last couple of weeks, I've been putting together a list of OSGi related talks that act as a useful resource for OSGi beginners.  I'm lucky enough to work in a development team full of talented people who are very happy to share their knowledge and experiences to customers and at conferences.  I wanted this youtube channel to provide a web resource so that we can share this information to a wider audience.

The short overview presentations are designed to giev the viewer a high level understanding of concepts without going into too much depth.  I'll put up links and follow up material which goes into more depth at our main OSGi home at

The new channel can be found at

Videos available right now on our new Enterprise OSGi channel include:

Big EARs and OSGi - Part 1, by Ian Robinson, IBM, Distinguished Engineer
Big EARs and OSGi - Part 2, by Ian Robinson, IBM, Distinguished Engineer
An Interview with Zoe Slattery, by Zoe Slattery, IBM, OSGi Technical Evangelist
JPA in OSGi, by Tim Ward, IBM, OSGi Applications developer in WAS.

More will be uploaded soon, so why not subscribe to the channel to get notification of when new videos are uploaded.  To subscribe, you'll need a YouTube account.  Click on the subscribe button on the top left of the Enterprise OSGi channel, shown below.