title: Problem with mapping servlet in RESTful web application
body: <p>I have a problem with deploying simple helloworld restful web application on Tomcat 9 in java 8 in IntelliJ. Only thing I recive is index.jsp page under <code>http://localhost:8080/Rozpro2_war_exploded/</code><br>
  On addresses <code>../Rozpro2_war_exploded/rest | ../Rozpro2_war_exploded/rest/hello | ../rest | ../rest/hello | ../Rozpro2/hello | ../hello</code> I get HTTP Status 404 – Not Found, both in browser and in Postman<br>
  web.xml:</p>
  
  <pre><code>&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_4_0.xsd"
          version="4.0"&gt;
     &lt;servlet&gt;
         &lt;servlet-name&gt;Jersey REST Service&lt;/servlet-name&gt;
         &lt;servlet-class&gt;org.glassfish.jersey.servlet.ServletContainer&lt;/servlet-class&gt;
         &lt;init-param&gt;
             &lt;param-name&gt;jersey.config.server.provider.packages&lt;/param-name&gt;
             &lt;param-value&gt;services&lt;/param-value&gt;
         &lt;/init-param&gt;
         &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
     &lt;/servlet&gt;
  
     &lt;servlet-mapping&gt;
         &lt;servlet-name&gt;Jersey REST Service&lt;/servlet-name&gt;
         &lt;url-pattern&gt;/rest/*&lt;/url-pattern&gt;
     &lt;/servlet-mapping&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p>HelloWrold class:<br></p>
  
  <pre><code>package services;
  
  import javax.ws.rs.GET;
  import javax.ws.rs.POST;
  import javax.ws.rs.Path;
  import javax.ws.rs.Produces;
  import javax.ws.rs.core.MediaType;
  
  @Path("hello")
  public class HelloWorld {
      @GET
      @Produces(MediaType.TEXT_PLAIN)
      public String sayHello(){
          return "Hello,I am text!";
      }
  
  
      @POST
      @Produces(MediaType.TEXT_XML)
      public String sayXMLHello() {
          return "&lt;?xml version=\"1.0\"?&gt;" + "&lt;hello&gt; Hello,I am xml!" + "&lt;/hello&gt;";
      }
  
      @GET
      @Produces(MediaType.TEXT_HTML)
      public String sayHtmlHello() {
          return "&lt;html&gt; " + "&lt;title&gt;" + "Hello Jersey" + "&lt;/title&gt;"
                  + "&lt;body&gt;&lt;h1&gt;" + "Hello,I am html!" + "&lt;/body&gt;&lt;/h1&gt;" + "&lt;/html&gt; ";
      }
  }
  </code></pre>
  
  <p>Index.jsp:<br></p>
  
  <pre><code>&lt;%@ page contentType="text/html;charset=UTF-8" language="java" %&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;Title&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  Hey
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>pom.xml as I import stuff with maven:<br></p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;groupId&gt;services&lt;/groupId&gt;
      &lt;artifactId&gt;Rozpro2&lt;/artifactId&gt;
      &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
      &lt;properties&gt;
          &lt;maven.compiler.source&gt;1.8&lt;/maven.compiler.source&gt;
          &lt;maven.compiler.target&gt;1.8&lt;/maven.compiler.target&gt;
      &lt;/properties&gt;
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.glassfish.jersey.containers&lt;/groupId&gt;
              &lt;artifactId&gt;jersey-container-servlet&lt;/artifactId&gt;
              &lt;version&gt;2.29&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.glassfish.jersey.inject&lt;/groupId&gt;
              &lt;artifactId&gt;jersey-hk2&lt;/artifactId&gt;
              &lt;version&gt;2.29&lt;/version&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>Run configuration:
  <a href="https://i.stack.imgur.com/1TgVS.png" rel="nofollow noreferrer">run configuration</a></p>
  
  <p><br>
  When I run Tomcat server I get logs:<br></p>
  
  <pre><code>[2020-03-15 11:55:24,049] Artifact Rozpro2:war exploded: Artifact is being deployed, please wait...
  15-Mar-2020 11:55:25.539 INFO [RMI TCP Connection(2)-127.0.0.1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
  [2020-03-15 11:55:27,512] Artifact Rozpro2:war exploded: Artifact is deployed successfully
  [2020-03-15 11:55:27,512] Artifact Rozpro2:war exploded: Deploy took 3,463 milliseconds
  </code></pre>
  
  <p>web.xml is in WEB-INF and I can see services in out/artifacts/Rozpro2_war_exploded/WEB-INF/services with HelloWorld.java inside.
  Does anybody have any idea why I'm not able to get any response from defined url?</p>