title: Tomcat Servlet Path
body: <p>I have this folder directory:</p>
  
  <p>webapps/ROOT/META-INF/</p>
  
  <p>......................context.xml</p>
  
  <p>webapps/ROOT/WEB-INF/</p>
  
  <p>......................web.xml</p>
  
  <p>webapps/ROOT/WEB-INF/lib</p>
  
  <p>.........................mysql-connector-java-5.1.23-bin.jar</p>
  
  <p>webapps/ROOT/WEB-INF/classes/com/mycompany/server/LoginServlet.class</p>
  
  <p>I have this web.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"&gt;
      &lt;servlet&gt;
          &lt;servlet-name&gt;LoginServlet&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/LoginServlet&lt;/url-pattern&gt;
          &lt;servlet-class&gt;com.mycompany.server.LoginServlet&lt;/servlet-class&gt;
          &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
      &lt;/servlet&gt;
      &lt;session-config&gt;
          &lt;session-timeout&gt;30&lt;/session-timeout&gt;
      &lt;/session-config&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p>LoginServlet.java has this <code>init()</code></p>
  
  <pre><code>@Override
  public void init(ServletConfig config) throws ServletException {
      System.out.println("Login Servlet Is Running");
      new Thread(guestRouter).start();
      System.out.println("path: '" + config.getServletName() + "'");
  }
  </code></pre>
  
  <p>When I start Tomcat, this the output (init loads and it finds the class).</p>
  
  <p><img src="https://i.stack.imgur.com/piym7.jpg" alt="enter image description here"></p>
  
  <p>However, when I go to <code>localhost:8080/LoginServlet</code> it says resource not found. Been struggling for days. Any help is appreciated!</p>