ticktock
ticktock

Reputation: 1703

jetty 9 symlink to exploded war

I've just upped to Jetty 9 from 8 and have an odd issue. My development environment is an exploded war, so I simply drop a symlink (ROOT) into my jetty/webapps directory pointing to my exploded war. This worked just fine for Jetty 8, but seems to fail for Jetty 9.

First, the symlink is now 'root', per the documentation. But when I hit my server '/' it gives me a 404 and this:

Error 404 - Not Found.

No context on this server matched or handled this request.
Contexts known to this server are:
/war ---> o.e.j.w.WebAppContext@613714d3{/war,file:/home/george/git/s/web_app/war/,AVAILABLE}{/home/george/git/s/web_app/war}

meaning that I can find my application served under '/war' instead of just '/'. Wacky.

Upvotes: 2

Views: 1992

Answers (1)

Joakim Erdfelt
Joakim Erdfelt

Reputation: 49515

This is due to a host of changes, mainly pointing at the use of Java 7 and requirements for the more recent Servlet specs.

Easy enough to fix for your situation tho.

  1. Don't use OS symlinks.
  2. Create a file called ${jetty.home}/webapps/mywebapp.xml with the following contents
<?xml version="1.0"  encoding="ISO-8859-1"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN"
      "http://www.eclipse.org/jetty/configure_9_0.dtd">

<Configure class="org.eclipse.jetty.webapp.WebAppContext">
  <Set name="contextPath">/</Set>
  <Set name="war">/home/george/git/s/web_app/war/</Set>
</Configure>

All done, you are now essentially using a Jetty Deployable XML Descriptor which sets the contextPath to / (aka Servlet Spec Root) and pointing to the war that you want to deploy.

Upvotes: 4

Related Questions