title: com.sun.jersey.api.client.UniformInterfaceException: myrequest returned a response status of 404 Not Found
body: <p><strong>myrequest</strong></p>
  
  <p><code>POST http://someIPA:PORT/MyWARFILENAME/backend/Activation/Request</code></p>
  
  <p>I am getting a 404 for a REST api call. This is the first time I am trying to run this. I know I am missing something really basic here.</p>
  
  <p><strong>Web.xml</strong>    </p>
  
  <pre><code>&lt;servlet&gt;
      &lt;servlet-name&gt;Jersey REST Service&lt;/servlet-name&gt;
      &lt;servlet-class&gt;com.sun.jersey.spi.container.servlet.ServletContainer&lt;/servlet-class&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;com.sun.jersey.config.property.packages&lt;/param-name&gt;
          &lt;param-value&gt;com.mycompany.backend.webservices&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;/webservices/*&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  </code></pre>
  
  <p><strong>Service Code</strong></p>
  
  <pre><code>package com.mycompany.backend.webservices;
  @Path("/Activation")
  public class Activation {
  
      @POST
      @Path("Request")
      @Consumes({ MediaType.APPLICATION_JSON })
      public Response post(JAXBElement&lt;CDeviceDetails&gt; data) {
          // Do my thing, set everything_is_ok to true/false
          if (everything_is_ok)
              return Response.ok(everthing).build();
          else
              return Response.notModified().build();
      }
  }
  </code></pre>
  
  <p><strong>junit test code</strong></p>
  
  <pre><code>    //
      // Activation Service
      //
      URI url = UriBuilder.fromUri(
              "http://" + SERVER + "/MyWARFILENAME/backend/Activation/Request")
              .build();
      WebResource service = client.resource(url);
      System.out.println(url);
      // Get the data ready
      CDeviceDetails newDevice = new CDeviceDetails(null, "mac id", "model",
              "manufacturer", "androidVersion", Calendar.getInstance()
                      .getTime(), "buildID", "fingerPrint", "board",
              "bootLoader", "hardware", "id", "product", "serial", Calendar
                      .getInstance().getTime(), Calendar.getInstance()
                      .getTime(), Globals.ACTIVE);
      String deviceUniqueIdentity = service.type(MediaType.APPLICATION_JSON)
              .post(String.class, newDevice);
      assertNotNull(deviceUniqueIdentity);
      System.out.println("Activation Passed " + deviceUniqueIdentity);
  </code></pre>
  
  <p><strong>Server side log /var/log/tomcat7/localhost_access_log.2014-09-28.txt</strong></p>
  
  <blockquote>
    <p>IPA - - [TIMESTAMP] "POST /MyWARFILENAME/backend/Activation/Request HTTP/1.1" 404 1049</p>
  </blockquote>
  
  <p>Which means that the request is reaching the server. Even if in <strong>//Do my thing..</strong> there is a exception, it should not matter, and I should not get a <code>404</code>.</p>
  
  <p>I suspect something fishy on the web.xml.</p>