title: Requested resource isn't available (Servlet)
body: <p>I created a dynamic web project in <code>Eclipse</code> 4.5, called <code>HelloServlet</code> and modified <code>web.xml</code>. I also added Tomcat 8 in Eclipse. I think I did everything right, but I still can't run the servlet.</p>
  
  <p>In Project explorer: /src/HelloServlet/HelloWorldServlet.java.</p>
  
  <p>HelloWorldServlet.java:</p>
  
  <pre><code>package HelloServlet;
  
  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 HelloWorldServlet
   */
  @WebServlet("/HelloWorldServlet")
  public class HelloWorldServlet 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().println("Hello world.");
      }
  
      /**
       * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
       */
      protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
          // TODO Auto-generated method stub
          doGet(request, response);
      }
  
  }
  </code></pre>
  
  <p>Web.xml:</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;HelloServlet&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;HelloWorldServlet&lt;/servlet-name&gt;
      &lt;servlet-class&gt;HelloServlet.HelloWorldServlet&lt;/servlet-class&gt;
    &lt;/servlet&gt;
    &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;HelloWorldServlet&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/HelloWorldServlet&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p>Sometimes, I get <code>class not found</code> without <code>/HelloWorldServlet</code>. I searched and knew how to set <code>servlet-class</code> correctly, but it still doesn't run.</p>