How to start Jetty as a OSGI bundle with JSP support?
I'm running Jetty 9.2 as a osgi bundle using Felix framework.In the command prompt,Apache Felix was started like
java -Djetty.home=C:/osgiJars/jetty-osgi-boot-9.2.0.M0/jettyhome -jar bin/felix.jar
My jetty home is like the following
Once the felix framework is started, in the command prompt i can see my list of bundles loaded in ACTIVE state.
Now, I'm trying to load an Sample web app(JSP + Servlets) as OSGi bundle.I'm getting an error like (in cmd prompt)
g! 2014-06-27 11:56:03.129:INFO:/WebApp:qtp31392457-30: No JSP support. Check that JSP jars are in
lib/jsp and that the JSP option has been specified to start.jar
I know that for JSP support to be configured, you need to set options while starting Jetty server like JETTY.OPTIONS= Server,jsp .
So,I've tried while setting Jetty home like
java -Djetty.home=C:/osgiJars/jetty-osgi-boot-9.2.0.M0/jettyhome -Djetty.options=Server,jsp -jar bin/felix.jar
But still getting same error. Anyone kindly suggest me how to configure my JSP in this case..?
Never tried to run jetty standalone for this, though there are two frameworks for OSGi HttpService support and much more. These are OPS4j Pax Web and Felix HttpService, as I'm kind of biased, take a look at Pax Web. It does provide all of what you need out of the box, and tested. It also uses Jetty as the underlying server. There are also a lot of samples available to get going with it. Or if needed integration tests to show how to actually use it.
Pax Web is modular in the spirit of OSGi, so if you just need a HttpService, you'll only use the bundles needed Pax-Web-API, Pax-Web-SPI, Pax-Web-Runtime and Pax-Web-Jetty-Bundle (containing the Jetty bundles already) or if prefered the Pax-Web-Jetty + jetty bundles. If you want to use JSPs add the supporting bundle of it (That would be Pax-Web-JSP), and maybe the one adding whiteboard support and you're set (Pax-Web-Extender-Whiteboard). If needed you can also work with wars/wabs (Pax-Web-Extender-War).
上一篇: OSGi与OSGi WAB捆绑在一起