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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With