title: Jetty - Servlet cannot be found
body: <p>I am new to Servlets and wanted to call a simple Servlet by using Eclipse's Jetty plugin. I can call the index.html, but when trying to access the Servlet I get:</p>
  
  <blockquote>
    <p>HTTP ERROR: 404<br>
    Problem accessing /ProjectServlet. Reason:<br>
       NOT_FOUND</p>
  </blockquote>
  
  <p>I think I configured all my files correctly and cannot explain why Jetty returns this error.</p>
  
  <p>Thanks for helping me!</p>
  
  <hr>
  
  <p><strong>index.html</strong></p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta charset="ISO-8859-1"&gt;
  &lt;title&gt;TEST&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;h1&gt;Servlet Call Test:&lt;/h1&gt;
      &lt;form action="/ProjectServlet" method="GET"&gt;
          &lt;input type="text" name="name" maxlength="20" value="Name" onfocus="this.select()"/&gt;&lt;br&gt;
          &lt;input type="submit" name="callservlet" value="Call Servlet."/&gt;
      &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <hr>
  
  <p><strong>ProjectServlet.java</strong></p>
  
  <pre><code>package servlets;
  
  
  import java.io.IOException;
  import javax.servlet.ServletException;
  import javax.servlet.annotation.WebServlet;
  import javax.servlet.http.HttpServlet;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  
  /**
   * Servlet implementation class ProjectServlet
   */
  @WebServlet(description = "Servlet to return JSON response with project list", urlPatterns = { "/ProjectServlet" })
  public class ProjectServlet extends HttpServlet {
      private static final long serialVersionUID = 1L;
  
      /**
       * Default constructor. 
       */
      public ProjectServlet() {
          super();
      }
  
      /**
       * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
       */
      protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  
          //Call Servlet Button
          if (request.getParameter("callservlet") != null) {
  
              response.setContentType("application/json");
  
              String name = request.getParameter("name"); 
              String jsonexample = "hi " + name; 
  
              response.getWriter().write(jsonexample);
          }
      }
  
      /**
       * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
       */
      protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
          // TODO Auto-generated method stub
      }
  
  }
  </code></pre>
  
  <hr>
  
  <p><strong>web.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"&gt;
    &lt;display-name&gt;Test&lt;/display-name&gt;
    &lt;welcome-file-list&gt;
      &lt;welcome-file&gt;index.html&lt;/welcome-file&gt;
      &lt;welcome-file&gt;index.htm&lt;/welcome-file&gt;
      &lt;welcome-file&gt;index.jsp&lt;/welcome-file&gt;
      &lt;welcome-file&gt;default.html&lt;/welcome-file&gt;
      &lt;welcome-file&gt;default.htm&lt;/welcome-file&gt;
      &lt;welcome-file&gt;default.jsp&lt;/welcome-file&gt;
    &lt;/welcome-file-list&gt;
  
    &lt;servlet&gt;
      &lt;servlet-name&gt;ProjectServlet&lt;/servlet-name&gt;
      &lt;servlet-class&gt;servlets.ProjectServlet&lt;/servlet-class&gt;
    &lt;/servlet&gt;
  
    &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;ProjectServlet&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/ProjectServlet&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
  &lt;/web-app&gt;
  </code></pre>