title: Getting 404 error with Jersey Tomcat service
body: <p>I am getting a 404 page when trying to run a RESTful service in Java with Jersey and Tomcat.</p>
  
  <p>Here is my project:</p>
  
  <h2><img src="https://i.stack.imgur.com/W8tSm.jpg" alt=""></h2>
  
  <p>Here is the HelloWorld.java:</p>
  
  <pre><code>package service;
  import javax.ws.rs.*;
  
  @Path("/hello")
  public class HelloWorld {
      @GET
      @Produces("text/plain")
      public String get() {
          return "Hello World";
      }
  }
  </code></pre>
  
  <p>Here is the web.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app id="WebApp_ID" 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;display-name&gt;EclipseTest&lt;/display-name&gt;
   &lt;servlet&gt;
    &lt;display-name&gt;Rest Servlet&lt;/display-name&gt;
    &lt;servlet-name&gt;RestServlet&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;service&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;RestServlet&lt;/servlet-name&gt;
    &lt;url-pattern&gt;/service/*&lt;/url-pattern&gt;
   &lt;/servlet-mapping&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p>I have tried these URLs based on other SO answers:</p>
  
  <p><a href="http://localhost:8080/EclipseTest/service/hello" rel="nofollow noreferrer">http://localhost:8080/EclipseTest/service/hello</a></p>
  
  <p><a href="http://localhost:8080/service/hello" rel="nofollow noreferrer">http://localhost:8080/service/hello</a></p>
  
  <p>When using 'Run As > Run on Server' it sends me to this page (404s):
  <a href="http://localhost:13036/EclipseTest/WEB-INF/classes/service/HelloWorld.java" rel="nofollow noreferrer">http://localhost:13036/EclipseTest/WEB-INF/classes/service/HelloWorld.java</a></p>
  
  <p>I am using:</p>
  
  <ul>
  <li>Java x64 7</li>
  <li>Jersey 2.17</li>
  <li>Tomcat x64 7.0.62</li>
  </ul>
  
  <p>Any help would be very appreciated.</p>