title: Eclipse - Maven project with Tomcat receives 404 Error
body: <p>I go over the internet to figure it out why I receive 404 I tried almost all solutions and didn't help. I have:</p>
  
  <ol>
  <li>Eclipse Photom</li>
  <li>Tomcat 9</li>
  <li>Java version 1.8</li>
  <li>Maven project using Jersey 2.27</li>
  </ol>
  
  <p>When I hit <a href="http://localhost:8080/Test/rest/testservice" rel="nofollow noreferrer">http://localhost:8080/Test/rest/testservice</a> I got 404 <strong>"Description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists."</strong></p>
  
  <p><strong>POM.XML</strong></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><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;Test&lt;/groupId&gt;
    &lt;artifactId&gt;com.test&lt;/artifactId&gt;
    &lt;packaging&gt;war&lt;/packaging&gt;
    &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
    &lt;name&gt;com.test Maven Webapp&lt;/name&gt;
    &lt;url&gt;http://maven.apache.org&lt;/url&gt;
  &lt;dependencies&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;junit&lt;/groupId&gt;
        &lt;artifactId&gt;junit&lt;/artifactId&gt;
        &lt;version&gt;3.8.1&lt;/version&gt;
        &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&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.27&lt;/version&gt;
   &lt;/dependency&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.27&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.27&lt;/version&gt;
   &lt;/dependency&gt;
      &lt;dependency&gt; 
       &lt;groupId&gt;javax.xml.bind&lt;/groupId&gt; 
       &lt;artifactId&gt;jaxb-api&lt;/artifactId&gt; 
      &lt;version&gt;2.2.6&lt;/version&gt; 
  &lt;/dependency&gt;
      
    &lt;/dependencies&gt;
    &lt;build&gt;
    &lt;plugins&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.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;com.test&lt;/finalName&gt;
    &lt;/build&gt;
  &lt;/project&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p><strong>WEB.XML</strong></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><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;Test Jersey 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;com.test&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;Test Jersey Service &lt;/servlet-name&gt;
   &lt;url-pattern&gt;/rest/*&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  
  &lt;/web-app&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p><strong>PROJECT STRUCTURE AND JAVA CLASS</strong></p>
  
  <p><a href="https://i.stack.imgur.com/9zU5Y.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9zU5Y.png" alt="PROJECT STRUCTURE AND JAVA CLASS"></a></p>
  
  <ol>
  <li>I Have added in Deployment Assembly -> Maven Dependencies also</li>
  </ol>