Growing pains: upgrading from Jetty 6 to Jetty 7
Over last week or so I decided to try upgrading my Jetty knowledge, by trying to deploy an existing web app (built to run on Jetty 6) on Jetty 7. Jetty 7 is a major upgrade, so it would not be realistic to expect no problems; but at the same time, it seems to be positioned as a transitional version before even bigger changes for version 8.
At any rate, a casual glance at documentation did not seem to have big blinking warnings. Jetty FAQ does say following: "Is Jetty 7 a drop in replacement for Jetty 6? -- No, while Jetty 7 has very much the same architecture as Jetty 6, there are packaging changes and other minor tweaks between the versions", but that does not sound like a big honking warning.
So I tried out using exact set up from previous deployment. And... surprise surprise, things did not work. What happened?
1. Library path: no more "-Djetty.lib=my-path"
Ok, first things first: turns out that a commonly used system property "jetty.lib" is no more. This was not mentioned directly anywhere; and more importantly, its replacement was not mentioned. And curiously some other similar properties (like "jetty.home") still works as before.
But simplest work-around I could found -- based on glancing at "start.config" and various documents -- was to simply "downgrade" System property into regular "property" (start.config distinguishes between the two by using either curly braces [System Property] or parentheses [plain properties), like so:
java -jar start.jar lib=my-path
and voila, libraries are ones again found as expected.
2. Got JSP?
Ok, me neither. This is what I saw next:
2010-04-09 18:56:06.927:INFO::NO JSP Support for /test-app, did not find org.apache.jasper.servlet.JspServlet
Turns out that the Eclipse download specifically does NOT include things
needed for JSP support; nor do default start up argument include
options. Rather, you MUST add "OPTIONS=xxx" (where 'xxx' can be "All",
for convenience, or list options like "Server,jsp").
And a
very important point: DO NOT try to pass OPTIONS as system property
(with leading "-D") -- this will not work. I accidentally tried that (or
maybe it is just because most other libs and apps pass any command-line
arguments via system properties; and very few do their own parsing like
Jetty does [so why does it? I have no clue])
After changing my start up line to:
java -jar start.jar -Djetty.home=$PWD/jetty-base lib=deploy/lib OPTIONS=Server,deploy,jsp $PWD/deploy/config/jetty.xml
(and, peculiarly, "jetty.home" IS a system property -- while cleaning things up, why was this NOT changed to a "regular" Jetty property? inquiring minds want to know!)
things started working. Happiness!
3. What else?
So far so good: these were the only hurdles. But given other indications in documentation, I suspect there are other differences I may bump into; in areas of default values (webdefault.xml), for example. But we'll cross those streams when we get there.
But so help others to troubleshoot issues, here are links to couple of really useful pages at Jetty wikis:
- Jetty FAQ
- Getting started with Jetty
- How to run Jetty, and Documentation of Start.jar for details of how to ACTUALLY start the thing -- especially useful for resolving classpath issues like my first issue.