title: Servlet 404 error - even after changing server location
body: <p>I am new to the Servlet Programming, I have configured the Eclipse IDE, and Tomcat Server in my Mac. Then I followed this <a href="http://www.javatpoint.com/creating-servlet-in-eclipse-ide" rel="nofollow noreferrer">JavatPoint Tutorial</a> to create a simple Hello World Servlet and run the project as on Tomcat server. But It shows 404.</p>
  
  <p>Then I referred and followed the following answers:</p>
  
  <p>Answer 1: <a href="https://stackoverflow.com/questions/19208164/tomcat-servlet-error-404-the-requested-resource-is-not-available">Tomcat Servlet: Error 404 - The requested resource is not available</a></p>
  
  <p>Answer 2: <a href="https://stackoverflow.com/questions/11290029/http-status-404-on-eclipse-with-tomcat">HTTP Status 404 - on Eclipse with Tomcat</a></p>
  
  <p>Answer 3: <a href="https://stackoverflow.com/questions/16340711/tomcat-http-status-404">TOMCAT - HTTP Status 404</a></p>
  
  <p>But nothing worked for me, Web container is configured means when I try this <a href="http://localhost:8080" rel="nofollow noreferrer">http://localhost:8080</a> in my browser, It shows Apache Tomcat page.</p>
  
  <p>I am using Eclipse Java EE Development version Mars(4.5.0), Apache Tomcat 8.0.26.</p>
  
  <p>I am trying for couple of days.</p>
  
  <p>Thanks in advance.</p>
  
  <p>Here is my Hello.java</p>
  
  <pre><code>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;
  
  /**
   * Servlet implementation class Hello
   */
  @WebServlet(name="Hello", urlPatterns={"/Hello"})
  public class Hello extends HttpServlet {
      private static final long serialVersionUID = 1L;
  
      /**
       * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
       */
      protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
          // TODO Auto-generated method stub
          //response.getWriter().append("Served at: ").append(request.getContextPath());
  
          response.setContentType("text/html");
          PrintWriter out = response.getWriter();
          out.print("&lt;html&gt;&lt;body&gt;");
          out.print("&lt;h1&gt;Hello&lt;/h1&gt;");
          out.print("&lt;/body&gt;&lt;/html&gt;");
      }
  }
  </code></pre>
  
  <p>My web.xml is:</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://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1"&gt;
    &lt;display-name&gt;MyFirst&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;/web-app&gt;
  </code></pre>
  
  <p>And the Servers view is like:
  <a href="https://i.stack.imgur.com/5n1E6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5n1E6.png" alt="enter image description here"></a></p>
  
  <p>Server Overview:</p>
  
  <p><a href="https://i.stack.imgur.com/SK4qt.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SK4qt.png" alt="enter image description here"></a></p>
  
  <p>In this Project name is <code>MyFirst</code> and my servlet name is <code>Hello</code>. After running the project, I am trying with this URL <a href="http://localhost:8080/MyFirst/Hello" rel="nofollow noreferrer">http://localhost:8080/MyFirst/Hello</a></p>