title: HTML 500 Tomcat Java
body: <p>I was trying to learn how to do Java Web Application with tomcat
  I am off to good start but when i try to load my servlet class i am getting 500 error</p>
  
  <h2>My newPlayer.java file:</h2>
  
  <pre><code>    package servlet;
      import java.io.IOException;
      import java.io.PrintWriter;
  
  
      /**
       * Created by kbuczynski on 24/01/17.
       */
  
      public class newPlayer extends javax.servlet.http.HttpServlet {
  
          protected void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOException {
          }
  
          protected void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOException {
              response.setContentType("text/html");
              PrintWriter out = response.getWriter();
              out.print("&lt;h1&gt;HI&lt;/h1&gt;");
              out.flush();
          }
  }
  </code></pre>
  
  <h2>web.xml</h2>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
           version="3.1"&gt;
      &lt;display-name&gt;WeBJ&lt;/display-name&gt;
      &lt;welcome-file-list&gt;
          &lt;welcome-file&gt;index.jsp&lt;/welcome-file&gt;
      &lt;/welcome-file-list&gt;
      &lt;servlet&gt;
          &lt;servlet-name&gt;newPlayer&lt;/servlet-name&gt;
          &lt;servlet-class&gt;servlet.newPlayer&lt;/servlet-class&gt;
      &lt;/servlet&gt;
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;newPlayer&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/newPlayer&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <h2>Error:</h2>
  
  <pre><code>exception
  
  javax.servlet.ServletException: Error instantiating servlet class servlet.newPlayer
      org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:474)
      org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
      org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:624)
      org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349)
      org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:495)
      org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
      org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:767)
      org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1347)
      org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
      java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      java.lang.Thread.run(Thread.java:745)
  root cause
  
  java.lang.ClassNotFoundException: servlet.newPlayer
      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:474)
      org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
      org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:624)
      org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349)
      org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:495)
      org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
      org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:767)
      org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1347)
      org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
      java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      java.lang.Thread.run(Thread.java:745)
  </code></pre>
  
  <h2>File Structure</h2>
  
  <p><a href="https://i.stack.imgur.com/HzHRy.png" rel="nofollow noreferrer">CLICK</a></p>
  
  <p>I am always happy to take any advice so feel free to do so.</p>