Building A Server Framework With Apache Tomcat: An OSGi Story

You are not authorized to post comments.
Session Type: 
Standard [35 minutes]

There are two approaches to run an OSGi environment; within a web-application (bridged mode) and as a pure OSGi runtime. This session describes the challenges we faced due to each of the above approaches, while building of an OSGi server runtime using Apache Tomcat. First we are going to look at the challenges we faced like ClassLoading issues, OSGi hacks, limitations, etc during the former approach and the solutions that we came up for the same. Next we are going to discuss how we adopted Apache Tomcat to implement the latter approach, pros and cons of it, the challenges while doing so and the possible solutions,workarounds.

Here at WSO2 we are in the business of building middleware servers. During the initial stages of the company we had several product offerings; ESB, Application Server, etc. Each of them using their own way of doing things to deliver common aspects such as, authentication and authorization, caching, coordination, etc. Then came OSGi; we broke down our monolithic product code into reusable components and came up with a unified platform called WSO2 Carbon. It provided common aspects such as, logging,user-mgt,registry-services, transports,caching, coordination, etc.

Initially we chose to build our servers with bridged-mode OSGi container; that is, we used embedded tomcat as the servlet container and used bridge-servlet mechanism to spawn up the OSGi container. It worked great for us, but we started to seeing complexities in the architecture as the time progresses. Some of the challenges we encountered includes:

* having to manage non-OSGi environment (embedded tomcat) as well an OSGi environments.
* ClassLoading issues, between two (OSGi and non-OSGi) environments
* Jar duplication between two environments.
* Using "not so nice" mechanisms such as, exporting packages through system framework to overcome some of those issues.
* could not support WAB

The next step was to run our products in a pure-OSGi environment. For that we had to come up with a bundled version of tomcat that exposes standard HTTPService in to the runtime, which we eventually did. That solved most of our classLoading nightmares and all the above issues, But presented us with some few
new challenges, like Managing the classpath to externally hosted web-apps in our platform , JNDI resource scoping among web-apps, etc.

We have solved some and are in the process of solving the issues found in our newly architected WSO2 Carbon Platform. Thanks to OSGi technology adoption WSO2 now, at the moment offer 18 different products such as ESBs, AppServers, Business Process Servers,etc. The same technology powers the WSO2s' platform-as-a-Service offering namely WSO2 Stratos.

Schedule info



OSGi DevCon
Experience level: 

feedbacks are highly appreciated

get notifications process.

Copyright © 2013 The Eclipse Foundation. All Rights Reserved.