How to deploy a webapp in Apache Felix?

What packages do I need to install? At least it should be a servlet container / web server like Jetty, but will there be a basic package org.apache.felix.http.jetty

, or is there something else that needs to be discovered web.xml

in other packages?

I put the webapp in a standard WAR, add the OSGi headers and do? Or are there any specific webapp headers required for the OSGi framework?

What other configuration do you need to do?

What are the options for automating these steps with Maven?

I tried deploying the package org.apache.felix.http.jetty

and I get a Jetty response from 404 to localhost: 8080. Then I tried a simple webapp with nothing but a static HTML file configured as welcome-file

. As far as I can tell, Jetty doesn't even notice the deployment descriptor, at least deploying the test webapp in Felix doesn't change anything.

+2


source to share


2 answers


Jetty and only one webapp is missing, there must be some glue that actually registers the webapp with the webserver in a specific context.

One example that works:

  • use the Pax web service in the package org.ops4j.pax.web.pax-web-service

    as an HTTP service, it starts Jetty too.
  • add header Webapp-Context

    to your package manifest
  • use the Pax web page extender to find this header when your package is registered, then it connects to the http service.


For some reason it must be a Pax webservice, if I replace it with the base prefix package from org.apache.felix it won't resolve the url correctly.

I'm still far from understanding what's going on here, but at least I got the job. I suspect you can get by without the Pax packages and the package header if you let your webapp package do something in your bundle activator to make the connection.

+1


source


You don't need to use Pax Web, but it makes things easier. Without Pax Web, you need a package that implements the OSGi HTTP service (there is a Jetty kit in there), then get a link to the HttpService. You can register your webapp with this, but it's tedious. Take a look at the Pax webcode if you want to see the gory details. Pax Web doesn't add anything to the HttpService, but it just handles all registration failures.



+1


source







All Articles