title: how to deploy web app to jetty
body: <p>I have an web app(actually a gwt app), and i want to deploy it to Jetty server for selenium testing, i used maven, maven-jetty-plugin, gwt-maven-plugin and selenium-maven-plugin, i finally got jetty and selenium sever running but the selenium tests fail because of the famous 404 eror:</p>
  
  <pre><code>com.thoughtworks.selenium.SeleniumException: XHR ERROR: URL = http://127.0.0.1:8080/index.html Response_Code = 404 Error_Message = Not Found
  </code></pre>
  
  <p>i m not sure if my jetty configuration is correct since i m kind of new to it, here is it(maven-jetty-plugin):</p>
  
  <pre><code>&lt;plugin&gt;
    &lt;groupId&gt;org.mortbay.jetty&lt;/groupId&gt;
    &lt;artifactId&gt;maven-jetty-plugin&lt;/artifactId&gt;
  
    &lt;configuration&gt;
      &lt;contextPath&gt;/sample-console&lt;/contextPath&gt;
      &lt;webAppSourceDirectory&gt;${basedir}/target/${project.artifactId}-${project.version}&lt;/webAppSourceDirectory&gt;
      &lt;webXml&gt;${basedir}/target/${project.artifactId}-${project.version}/WEB-INF/web.xml&lt;/webXml&gt;
    &lt;/configuration&gt;
            &lt;executions&gt;
               &lt;execution&gt;
                  &lt;id&gt;start-jetty&lt;/id&gt;
                  &lt;phase&gt;pre-integration-test&lt;/phase&gt;
                  &lt;goals&gt;
                      &lt;goal&gt;run&lt;/goal&gt;
                  &lt;/goals&gt;
                   &lt;configuration&gt;
                      &lt;daemon&gt;true&lt;/daemon&gt;
                  &lt;/configuration&gt;
              &lt;/execution&gt;
               &lt;execution&gt;
                  &lt;id&gt;stop-jetty&lt;/id&gt;
                  &lt;phase&gt;post-integraion-test&lt;/phase&gt;
                  &lt;goals&gt;
                      &lt;goal&gt;stop&lt;/goal&gt;
                  &lt;/goals&gt;
              &lt;/execution&gt;
            &lt;/executions&gt; 
  &lt;/plugin&gt;
  </code></pre>
  
  <p>when i ran mvn clean install, i can see the output from command window:</p>
  
  <pre><code>[INFO] Configuring Jetty for project: DYI sample Console
  [INFO] Webapp source directory = /Users/dyi/Documents/workspace/sample/console/target/sample-console-0.1-SNAPSHOT
  [INFO] Reload Mechanic: automatic
  [INFO] Classes = /Users/dyi/Documents/workspace/sample/console/target/classes
  log4j:WARN No appenders could be found for logger (org.mortbay.log).
  log4j:WARN Please initialize the log4j system properly.
  [INFO] Context path = /sample-console
  [INFO] Tmp directory =  determined at runtime
  [INFO] Web defaults = org/mortbay/jetty/webapp/webdefault.xml
  [INFO] Web overrides =  none
  [INFO] web.xml file = /Users/dyi/Documents/workspace/sample/console/target/sample-console-0.1-SNAPSHOT/WEB-INF/web.xml
  [INFO] Webapp directory = /Users/dyi/Documents/workspace/sample/console/target/sample-console-0.1-SNAPSHOT
  [INFO] Starting jetty 6.1.22 ...
  [INFO] Started Jetty Server
  [INFO] [selenium:start-server {execution: start}]
  </code></pre>
  
  <p>and my folder structure looks like this:</p>
  
  <pre><code>--sample/
     -- console/
          -- src/
          -- target/
               -- classes/
               -- sample-console-0.1-SNAPSHOT/
                     -- css/
                     -- images/
                     -- img/
                     -- index.html
                     -- js/
                     -- META-INF/
                     -- security/
                     -- test.html
                     -- WEB-INF/ 
                           -- classes/
                           -- lib/
                           -- web.xml
  </code></pre>
  
  <p>the thing i don't understand is i can see the index.html page is right there in the folder 'sample-console-0.1-SNAPSHOT', why it cannot find it? is that because i set the 'contextPath' wrong? i tried setting it to '/', then i got 503 service not available error. anyone can help? much thanks!!</p>