title: Java - Why am I getting "HTTP Status 500 - Error instantiating servlet class"?
body: <p>I created a Dynamic Web Project. I have Tomcat 7.0 installed to run it. This is my first time making a Website with java so I'm completely clueless as to what the problem might be.
  Here is my code:</p>
  
  <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://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" version="3.0"&gt;
    &lt;display-name&gt;SimpleTest&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;Hello&lt;/servlet-name&gt;
    &lt;servlet-class&gt;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;
  &lt;/web-app&gt;
  </code></pre>
  
  <p>Hello.java</p>
  
  <pre><code>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 Hello
   */
  @WebServlet("/Hello")
  public class Hello extends HttpServlet {
      private static final long serialVersionUID = 1L;
  
      /**
       * @see HttpServlet#HttpServlet()
       */
      public Hello() {
          super();
          // TODO Auto-generated constructor stub
      }
  
      /**
       * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
       */
      protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
          System.out.println("Hello");
      }
  
  }
  </code></pre>
  
  <p>index.jsp</p>
  
  <pre><code>&lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1"
      pageEncoding="ISO-8859-1"%&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt;
  &lt;title&gt;Insert title here&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;form action="Hello" method="post"&gt;
          Name: &lt;input type="text" name="name" value="" /&gt;
          &lt;input type="submit" name="name" value="Submit" /&gt;
      &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>The app just prints "Hello" when submit is clicked. I made it like this because I just wanted to make sure the servlet was working first.</p>