title: HTTP Status 404 - Servlet [ServletName] is not available
body: <p><strong>The problem</strong> : My index.jsp with web.xml keeps going into HTTP 404 and 500</p>
  
  <p>I'm using Tomcat6 .</p>
  
  <p>This is from index.jsp : </p>
  
  <pre class="lang-html prettyprint-override"><code>  &lt;legend&gt;Registration&lt;/legend&gt;
    &lt;form action="./register"&gt; &lt;%-- Address from web.xml  --%&gt;
      First name: &lt;input type="text" name="firstName"&gt;&lt;br&gt;
      Last name: &lt;input type="text" name="lastName"&gt;&lt;br&gt;
      &lt;input type="submit" value="Register"&gt;
    &lt;/form&gt;
  </code></pre>
  
  <p>When I'm in Registration : </p>
  
  <p><img src="https://i.stack.imgur.com/vGpsg.gif" alt="enter image description here"></p>
  
  <p>and I hit the name and last-name , I go into 404 , the message : </p>
  
  <blockquote>
    <h2>HTTP Status 404 - Servlet RegistrationServlet is not available</h2>
    
    <p><strong>type</strong> Status report</p>
    
    <p><strong>message</strong> Servlet RegistrationServlet is not available</p>
    
    <p><strong>description</strong> The requested resource (Servlet RegistrationServlet is not available) is not available.</p>
    
    <p>Apache Tomcat/6.0.35</p>
  </blockquote>
  
  <p>What do you think it the cause for that error ? </p>
  
  <p>The class <code>RegistrationServlet</code> is under the file <code>RegistrationServlet.java</code> in the folder <code>src/coreservlets/</code></p>
  
  <p>I checked web.xml but it seems to be okay , but here it is (if it would be helpful):</p>
  
  <pre class="lang-xml prettyprint-override"><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/j2ee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4"&gt;
    &lt;servlet&gt;
      &lt;servlet-name&gt;ShowBalance&lt;/servlet-name&gt;
      &lt;servlet-class&gt;coreservlets.ShowBalance&lt;/servlet-class&gt;
    &lt;/servlet&gt;
    &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;ShowBalance&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/show-balance&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
    &lt;servlet&gt;
      &lt;servlet-name&gt;RandomNumberServlet&lt;/servlet-name&gt;
      &lt;servlet-class&gt;coreservlets.RandomNumberServlet&lt;/servlet-class&gt;
    &lt;/servlet&gt;
    &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;RandomNumberServlet&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/random-number&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
    &lt;servlet&gt;
      &lt;servlet-name&gt;RegistrationServlet&lt;/servlet-name&gt;
      &lt;servlet-class&gt;coreservlets.RegistrationServlet&lt;/servlet-class&gt;
    &lt;/servlet&gt;
    &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;RegistrationServlet&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/register&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
    &lt;servlet&gt;
      &lt;servlet-name&gt;PrimeServlet&lt;/servlet-name&gt;
      &lt;servlet-class&gt;coreservlets.PrimeServlet&lt;/servlet-class&gt;
    &lt;/servlet&gt;
    &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;PrimeServlet&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/prime&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
    &lt;welcome-file-list&gt;
      &lt;welcome-file&gt;index.jsp&lt;/welcome-file&gt;
      &lt;welcome-file&gt;index.html&lt;/welcome-file&gt;
    &lt;/welcome-file-list&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p>I've been trying to fix this little culprit for the last two days but nothing , any help would be much appreciated . </p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>As requested , here is <code>RegistrationServlet</code></p>
  
  <pre><code>package coreservlets;
  
  import java.io.*;
  import javax.servlet.*;
  import javax.servlet.http.*;
  
  public class RegistrationServlet extends HttpServlet {
  
      private static final long serialVersionUID = 1L;
  
      @Override
      public void doGet(HttpServletRequest request, HttpServletResponse response)
              throws ServletException, IOException {
          HttpSession session = request.getSession();
          synchronized (session) {
              NameBean nameBean = (NameBean) session.getAttribute("name");
              if (nameBean == null) {
                  nameBean = new NameBean();
                  session.setAttribute("name", nameBean);
              }
              nameBean.setFirstName(request.getParameter("firstName"));
              nameBean.setLastName(request.getParameter("lastName"));
              String address = "/WEB-INF/mvc-sharing/ShowName.jsp";
              RequestDispatcher dispatcher = request
                      .getRequestDispatcher(address);
              dispatcher.forward(request, response);
          }
      }
  }
  </code></pre>
  
  <p>Also here is the project tree :</p>
  
  <p><img src="https://i.stack.imgur.com/enUDA.gif" alt="enter image description here"></p>