title: JAX-RS Jersey Maven HTTP Status 404 The origin server did not find a current representation for the target resource
body: <p>I'm new to JAX-RS and I've created a Maven project but when I try and invoke my service I get the following server status on Tomcat</p>
  
  <blockquote>
    <p>HTTP Status 404: The origin server did not find a current
    representation for the target resource or is not willing to disclose
    that one exists.</p>
  </blockquote>
  
  <p>pom.xml</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/maven-v4_0_0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;groupId&gt;com.lymedo.rest&lt;/groupId&gt;
      &lt;artifactId&gt;RestService&lt;/artifactId&gt;
      &lt;packaging&gt;war&lt;/packaging&gt;
      &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
      &lt;name&gt;RestService Maven Webapp&lt;/name&gt;
      &lt;url&gt;http://maven.apache.org&lt;/url&gt;
      &lt;dependencies&gt;
          &lt;!-- https://mvnrepository.com/artifact/org.glassfish.jersey.core/jersey-server --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.glassfish.jersey.core&lt;/groupId&gt;
              &lt;artifactId&gt;jersey-server&lt;/artifactId&gt;
              &lt;version&gt;2.26-b03&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;!-- https://mvnrepository.com/artifact/org.sonatype.aether/aether-api --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.sonatype.aether&lt;/groupId&gt;
              &lt;artifactId&gt;aether-api&lt;/artifactId&gt;
              &lt;version&gt;1.7&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.sonatype.aether&lt;/groupId&gt;
              &lt;artifactId&gt;aether-impl&lt;/artifactId&gt;
              &lt;version&gt;1.7&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;commons-io&lt;/groupId&gt;
              &lt;artifactId&gt;commons-io&lt;/artifactId&gt;
              &lt;version&gt;2.4&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;!-- https://mvnrepository.com/artifact/com.google.code.findbugs/jsr305 --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.google.code.findbugs&lt;/groupId&gt;
              &lt;artifactId&gt;jsr305&lt;/artifactId&gt;
              &lt;version&gt;2.0.1&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.maven&lt;/groupId&gt;
              &lt;artifactId&gt;maven-aether-provider&lt;/artifactId&gt;
              &lt;version&gt;3.0&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.maven&lt;/groupId&gt;
              &lt;artifactId&gt;maven-artifact&lt;/artifactId&gt;
              &lt;version&gt;3.0&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
              &lt;version&gt;3.5.1&lt;/version&gt;
              &lt;type&gt;maven-plugin&lt;/type&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;artifactId&gt;maven-jar-plugin&lt;/artifactId&gt;
                  &lt;version&gt;2.4&lt;/version&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                  &lt;version&gt;3.5.1&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;source&gt;1.8&lt;/source&gt;
                      &lt;target&gt;1.8&lt;/target&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
          &lt;finalName&gt;RestService&lt;/finalName&gt;
      &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>web.xml</p>
  
  <pre><code>&lt;!DOCTYPE web-app PUBLIC
   "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
   "http://java.sun.com/dtd/web-app_2_3.dtd" &gt;
  &lt;web-app&gt; 
  
      &lt;display-name&gt;Archetype Created Web Application&lt;/display-name&gt;
  
      &lt;servlet&gt;
          &lt;servlet-name&gt;jersey-serlvet&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;com.lymedo&lt;/param-value&gt;
          &lt;/init-param&gt;
      &lt;/servlet&gt;
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;jersey-serlvet&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/rest/*&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p>Service</p>
  
  <pre><code>package com.lymedo;
  
  import javax.ws.rs.GET;
  import javax.ws.rs.Path;
  import javax.ws.rs.Produces;
  import javax.ws.rs.core.MediaType;
  
  @Path("/service")
  public class Service {
  
      @GET
      @Path("/hello")
      @Produces(MediaType.TEXT_PLAIN)
      public String sayHello(){
  
          return "Hello!";
  
      }
  
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/7WLuV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7WLuV.png" alt="Project Structure"></a></p>
  
  <p>I'm using Postman to test the service with the following URL: 
  <a href="http://localhost:8080/RestService/rest/service/hello" rel="nofollow noreferrer">http://localhost:8080/RestService/rest/service/hello</a></p>
  
  <p>So I'm assuming it's a mapping issue and Tomcat can't find the class where the service is declared??</p>
  
  <p>I'm hoping it is something obvious. Any help will be appreciated. Thanks</p>