title: HTTP Status 500 - Error instantiating servlet class example.webApp
body: <p>I created simple servlet and deployed it to tomcat server but I got the following error: <code>HTTP Status 500 - Error instantiating servlet class example.webApp</code>
  Screenshot :</p>
  
  <p><img src="https://i.stack.imgur.com/hDTbB.png" alt="enter image description here"></p>
  
  <p>webApp.java:</p>
  
  <pre><code>package example;
  
  import java.io.IOException;
  import java.util.Date;
  
  import javax.servlet.ServletException;
  import javax.servlet.http.HttpServlet;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  
  public class webApp extends HttpServlet {
      @Override
      protected void doGet(HttpServletRequest req, HttpServletResponse resp) 
              throws ServletException, IOException {
          resp.getWriter().println("Testing tomcat") ;
      }
  }
  </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;servlet&gt; 
      &lt;servlet-name&gt;Test&lt;/servlet-name&gt;
      &lt;servlet-class&gt;example.webApp&lt;/servlet-class&gt;
    &lt;/servlet&gt;
    &lt;servlet-mapping&gt; 
      &lt;servlet-name&gt;Test&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/test&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
  
    &lt;display-name&gt;test&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;/web-app&gt;
  </code></pre>
  
  <p>When I  write <code>localhost:8080/test/test</code> to the Eclipse Browser I get upper above. If I enter <code>localhost:8080/test/test</code> again, I get this error:<a href="http://i.hizliresim.com/YBYE4z.png" rel="nofollow noreferrer">http://i.hizliresim.com/YBYE4z.png</a></p>
  
  <p>I am confused. Can you help me? What is wrong?
  Sorry to give picture links because I couldn't update directly to this website.</p>
  
  <p>The first picture's text is :</p>
  
  <p>type Exception report</p>
  
  <p>message Error instantiating servlet class example.webApp</p>
  
  <p>description The server encountered an internal error that prevented it from fulfilling this request.</p>
  
  <p>exception</p>
  
  <pre><code>javax.servlet.ServletException: Error instantiating servlet class example.webApp
      org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
      org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
      org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:617)
      org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
      org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
      org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:668)
      org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1527)
      org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1484)
      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)
  
  
  root cause
  java.lang.ClassNotFoundException: example.webApp
      org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1313)
      org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1164)
      org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
      org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
      org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:617)
      org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
      org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
      org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:668)
      org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1527)
      org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1484)
      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>note The full stack trace of the root cause is available in the <code>Apache Tomcat/8.0.24</code> logs.</p>