Running Axis2 in OSGi Environments Print
Written by Valery Abu-Eid   
Thursday, 04 September 2008 19:48

Currently there is ongoing work in the Axis2 project to make Axis2 engine not only compatible with OSGi but also take all the advantages that OSGi infrastructure provides so developers could deploy Web Services and Modules in bundles. This link is the first and currently the only resource that provides information on how to run Axis2 in an OSGi Environment. Below are the main problems I had while running the example:

  • It took me 2-4 hours to run the example - This is taking into account that I left all non-bundled libraries (JAR files that has no OSGi headers) for DA-Launcher to handle instead of generating bundles myself from 10-20 non-bundled libraries.
  • The set of bundles that was used to run the example is tied to Equinox so it's impossible to run Axis2 with the same choice of bundles using Apache Felix.

Going through this, I decided to make an application that would allow me run Axis2 in an OSGi Environment within few seconds - It's just I'm pretty sure that I'm not the only one who have such problem. It took me much more time to create the application rather to follow the example provided in the link above because I wanted the application to be runnable on Equinox and Felix in the Java Environments JRE and JDK versions 1.5 and 1.6.

The application can be downloaded from the link below:

axis2-osgi-example.zip

You can run the application by executing either the batch or the script file in the "/axis2-osgi/bin" directory or by executing the following command from the "/axis2-osgi" directory:

> java -jar ./lib/da-launcher-1.0.2.jar

The example application already has one Web Service "Version Web Service" whose WSDL is accessible from "http://localhost:8080/services/Version?wsdl". The application also contains a Web Admin interface which is accessible from "http://localhost:8080/system/console/list". If you would like to change the port then make sure to check the readme.txt file in example's archive.

Below are key implementation issues:

  • DA-Launcher was used to launch the application: DA-Launcher was used to launch the application as such the application can be configured easily to run on Equinox or Felix and Web Service bundles can be installed/uninstalled by simply copying/removing bundle archives in the Application Bundles directory.
  • Non-bundled libraries: I used 12 non-bundled libraries, I left them for DA-Launcher to generate bundles from them. So when you run the application for the first time DA-Launcher will generate bundles from non-bundled libraries then cache them, so next time you run the application DA-Launcher will use the cached bundles instead of regenerating them.
  • Pax Web Service: To remove the dependency on Equinox Framework, I used Pax Web Service bundle as the Http Service for the application. The Pax Web Service bundle provides the implementation of the HTTP Service defined by OSGi Service Compendium specification and contains Servlet API and Jetty Web Server Engine classes.
  • Snapshot version of Axis2 and Axiom: Axis2 and Axiom snapshots were used since there were no releases for them.
  • Modifications to Axiom sources: The only modification to the source code of Axiom was specifying the version "1.0.0" for the imported package "javax.xml.stream". No modifications were done for the source code of Axis2.

Unfortunately, the application is not runnable from Knopflerfish due to some problems that I hadn't enough time to investigate.

If you need to run JAX-WS RI dynamically in OSGi Environments then you can check the Dynamic-WS project.