title: Getting HTTP Status 404 error when trying to run servlet
body: <p>I have a problem with my simple servlet that I am trying to run, Hello.java. I made it in eclipse, then placed the file it in the <code>webapps/ServletTest/WEB-INF/classes</code> folder and compiled it, creating the file <code>Hello.class</code> in the same folder. I then modified my web.xml file to map the servlet and tried to run it through the following address </p>
  
  <pre><code>http://localhost:8080/ServletTest/Hello
  </code></pre>
  
  <p>However, this did not work, giving the following error</p>
  
  <p><strong>HTTP Status 404 -</strong></p>
  
  <p><strong>type Status report</strong></p>
  
  <p><strong>message</strong> </p>
  
  <p><strong>description The requested resource is not available.
  Apache Tomcat/7.0.42</strong></p>
  
  <p>The mapping in the web.xml file looks like this:</p>
  
  <pre><code>&lt;servlet&gt;
  &lt;servlet-name&gt;Hello&lt;/servlet-name&gt;
  &lt;servlet-class&gt;Main.Hello&lt;/servlet-class&gt;
  &lt;/servlet&gt;  
  
  &lt;servlet-mapping&gt;
  &lt;servlet-name&gt;Hello&lt;/servlet-name&gt;
  &lt;url-pattern&gt;/Hello&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt; 
  </code></pre>
  
  <p>The code of the servlet:</p>
  
  <pre><code>package Main;
  import java.io.IOException;
  import java.io.PrintWriter;
  
  import javax.servlet.ServletException;
  import javax.servlet.annotation.WebServlet;
  import javax.servlet.http.HttpServlet;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  @WebServlet("/Hello")
  public class Hello extends HttpServlet {
  private static final long serialVersionUID = 1L;
  public Hello() {
  super();
   }
  
  protected void doGet(HttpServletRequest request, HttpServletResponse                   
  
  response)  throws ServletException, IOException {
      PrintWriter out = response.getWriter();
      response.setContentType("text/html");
      String path = request.getContextPath();
      String ip = request.getRemoteAddr();
      out.print("&lt;html&gt;" +
      "&lt;title&gt;Hello&lt;/title&gt;" +
              "Hello World"+ "&lt;br&gt;" +
      "Your ip is: " + ip + "&lt;br&gt;" +
      "Your path is: " + path
      + "&lt;/html&gt;");       
  }
  protected void doPost(HttpServletRequest request, HttpServletResponse response)   
  
  throws     ServletException, IOException {
  
  }
  
  }
  </code></pre>