title: HTTP Status 500 - Error instantiating servlet class servlets.LoginServlet
body: <p>So I am working on an assignment for school and this error is happening and I don't know how to fix it. I don't think it's a coding error, just a project setup error.</p>
  
  <p>Here is a screenshot:
  <a href="https://i.stack.imgur.com/JUYoC.png" rel="nofollow"><img src="https://i.stack.imgur.com/JUYoC.png" alt="enter image description here"></a></p>
  
  <p>Any help would be appreciated. I've tried the other answers I've found online such as "Project Clean..." etc and nothing works.</p>
  
  <p>EDIT 1/</p>
  
  <pre><code>javax.servlet.ServletException: Error instantiating servlet class servlets.LoginServlet
  org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
  org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
  org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
  org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349)
  org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:784)
  org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
  org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:802)
  org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1455)
  org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
  java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
  java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
  org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
  java.lang.Thread.run(Unknown Source)
  
  java.lang.ClassNotFoundException: servlets.LoginServlet
  org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1275)
  org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1109)
  org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
  org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
  org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
  org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349)
  org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:784)
  org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
  org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:802)
  org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1455)
  org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
  java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
  java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
  org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
  java.lang.Thread.run(Unknown Source)
  </code></pre>
  
  <p>I can't seem to post the web.xml on here...
  <a href="http://hastebin.com/sadikezece.xml" rel="nofollow">http://hastebin.com/sadikezece.xml</a></p>
  
  <p>LoginServlet.java</p>
  
  <pre><code>package servlets;
  
  import java.io.IOException;
  import java.io.Serializable;
  
  import javax.servlet.ServletException;
  import javax.servlet.http.HttpServlet;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  import javax.servlet.http.HttpSession;
  
  import beans.UserBean;
  
  /**
   * Servlet implementation class LoginServlet
   */
  public class LoginServlet extends HttpServlet implements Serializable {
  
  
  
  /**
   * 
   */
  private static final long serialVersionUID = 1L;
  
  /**
   * @see HttpServlet#HttpServlet()
   */
  public LoginServlet() {
      super();
      // TODO Auto-generated constructor stub
  }
  
  /**
   * @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());
  
      UserBean user = new UserBean();
      user.setUsername(request.getParameter("username"));
      user.setPassword(request.getParameter("password"));
  
  }
  
  /**
   * @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>}</p>
  
  <p>Didn't do anything to it because it wasn't running.</p>