title: Tomcat and OSGi
body: <p>I was wondering if it is possible to embed an OSGi container like <a href="http://karaf.apache.org/" rel="nofollow noreferrer">Karaf</a> inside a Tomcat instance. According to <a href="https://stackoverflow.com/questions/10252768/to-embed-osgi-in-servlet-container-or-servlet-container-in-osgi">this SO question</a> and a few others, it seems like its <em>possible</em>, but I can't seem to find any solid details on how to do this or what pitfalls/caveats to watch out for.</p>
  
  <p>So:</p>
  
  <ol>
  <li>Is it possible to embed an OSGi container inside Tomcat, so that I can hot-deploy OSGi bundles at any point to this container without having to restart Tomcat?</li>
  <li>If the answer to #1 above is "yes", then what system services/ports does embedding OSGi inside Tomcat expose? I ask because I would like to deploy OSGi in a Tomcat server hosted on a Java PaaS where I don't have admin rights. And I'm wondering if - when I try to deploy the embedded OSGi container to Tomcat, that it will try to start listening on ports, or perhaps start doing something to the local file system. If this is the case I will likely receive security/permission errors.</li>
  </ol>
  
  <p>Thanks in advance!</p>