Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Integrating Equinox OSGi into Apache Tomcat web app

Tags:

java

osgi

equinox

Is it possible to introduce osgi-equinox into existing java Apache Tomcat project? From my understanding OSGI must run inside some kind of "container". How would I integrate it?

I am also using Jersey for RESTful resources.

like image 746
Andriy Drozdyuk Avatar asked Oct 08 '10 18:10

Andriy Drozdyuk


1 Answers

You may want to look at this question: OSGI runtime inside traditional Java EE server.

In this bridge model, a special servlet is installed and Tomcat invokes this servlet to handle the request. An OSGi runtime is spawned from within this servlet, but the OSGi runtime itself (e.g. equinox) is agnostic of things like HTTP. An OSGi HTTP service bundle is also installed, and you'll need to register your web app (servlet, jsp, ...) against this OSGi HTTP service to handle the incoming requests. Therefore, it is not like there is a separate "web server" to speak of that listens on its own port and manages HTTP on its own outside Tomcat. Your mileage may vary, but the overhead is basically limited to whatever the OSGi HTTP service might add when it forwards the request from the Tomcat connector to your servlet.

This bridge model is needed if you cannot change the existing deployment model. In the long run, a better model is to have the OSGi runtime first and have Tomcat (or any other OSGi-compliant container) plug into the OSGi runtime as bundles.

like image 90
sjlee Avatar answered Sep 22 '22 02:09

sjlee