Note that this will only work in pax-web version 0.5.2 or higher and requires an OSGi container that supports OSGi bundle fragments. I was doing this in Felix 1.6.0 (inside Sling).
- Checkout my bundle fragment source code
https://source.caret.cam.ac.uk/camtools/trunk/sling/sling-jetty-config - Edit the jetty.xml file to suit your taste
(the one in there enables AJP) - Build using Maven 2
mvn clean install -Pajp
(Leave off the -Pajp if you are not enabling/using ajp) - Install the bundle fragment into your OSGi container using whatever mechanism you are used to. It tends to work best to install it with the same level as the bundle it is being used with.
- Restart the OSGi container
(this is not always required but I find it tends to work a lot better if you do)
If there are problems (the fragment seems to have no effect) then here are a few debugging steps that may work:
- If you are using felix then you can run the resolve command from the felix command shell for your fragment. If you get nothing then you are probably good to go, if you get a failure then the Fragment-Host: org.ops4j.pax.web.pax-web-service value probably does not match the one in your container. Make sure the value is the same as the symbolic name of your installed pax-web-service-*.jar.
- Try making sure your jetty.xml actually works with Jetty. There are instructions on the Jetty website.
2 comments:
Do you have some problems with logging when configuring your jetty server? I have a problem with creating directory for logs, but when I create it by myself log-files will be created there without any problems.
Thanks for this great information - you saved my day. It works like a charme!
Post a Comment