Friday, June 27, 2008

OSGi and TCCL dilemma

OSGi in server side is still in its infant stage, though the technology is prominent in embedded and mobile devices space. Most of the time use will try to wrap the non-OSGi libraries to bundles including proper import, export etc OSGi headers. There are so many tools available for this conversion in web, and one of the most popular tool is maven-bundle-plugin that associate with Maven2.

In order to OSGi import/export paradigm to work, bundle must use the bundle classloader. But many of the wrapped non-OSGi bundles might have used system classloader or thread context class loader (TCCL). Problem arise when TCCL is used and which is not fully explained in current OSGi specification.

Luckily, Eclipse Equinox OSGi implementation has addressed this problem by setting a "ContextFinder" in systems bundles TCCL, which is capable of traversing the bundle classloader cache and obtaining the relevant resources and classes. But other OSGi implementations such as Knopflerfish uses, what they called "byte code injection". Apache Felix has not covered this dilemma yet.

So IMO, in order to OSGi to be dominant in server side, TCCL problem should be addressed and it should be addressed quite soon.

Thursday, June 26, 2008

Embed Eclipse Equinox in a Servlet Container

OSGi is dominant mobile phones and handheld devices. Now the interest has significantly moved from these embedded to full blown servers. Hence, people are looking at eliminating barriers using OSGi on servers.

Eclipse Equinox is pursing work related to "Server-Side Equinox". The target is to embed Equinox in a Servlet Container, using what is called the principle of "servletbridge" to run OSGi based application in a servlet container.

To test this out read here,

In summary.

1. Install your favourite servlet container (Tomcat, Jetty etc)
2. Download and deploy per-build web application archive (bridge.war)
3. Start the web container (http://localhost:8080/bridge)
4. There are bunch of things you can do, which will be available here.

"servletbridge" is a cool concept, which can be applied to any OSGi implementation, such as Apache Felix, Knopflerfish etc
Hence, WSO2 Carbon, the next generation web services infrastructure powered by enterprise Axis2 uses "servletbridge" concept to provide an OSGi environment to uses to embed bundles that mimic the behavior of Axis2 service & module archives.

Wednesday, June 25, 2008

New look to Apache Axis2 with OSGi

Apache Axis2 has span its spectrum with the incorporation of OSGi integration. This will be mainstream in next Axis2 main release. In summary, there exist an OSGi bundle, org.apache.axis2.osgi_.jar, which can be deployed in any OSGi environment. This bundle has few wire dependencies to other bundles, which can either be available in the OSGi implementation or one can simply create them using most popular bundling tools.

In order to better understand how this will work in Eclipse Equinox OSGi implementation, I have create a scratch project, which will be available here. Just do an svn checkout on prior url. Do follow the axis2_osgi_integration.pdf for more comprehensive detail of this effort.