title: Client REST throwing javax.ws.rs.NotFoundException
body: <p>I am trained to develop my end of study project, but I meet an exception.
  Therefore, I have written a client REST invoke a web service.</p>
  
  <p>Here is my web.xml:</p>
  
  <pre><code>&lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"&gt;
    &lt;display-name&gt;AirQuality&lt;/display-name&gt;
    &lt;welcome-file-list&gt;
      &lt;welcome-file&gt;index.html&lt;/welcome-file&gt;
      &lt;welcome-file&gt;index.htm&lt;/welcome-file&gt;
      &lt;welcome-file&gt;index.jsp&lt;/welcome-file&gt;
      &lt;welcome-file&gt;default.html&lt;/welcome-file&gt;
      &lt;welcome-file&gt;default.htm&lt;/welcome-file&gt;
      &lt;welcome-file&gt;default.jsp&lt;/welcome-file&gt;
    &lt;/welcome-file-list&gt;
    &lt;servlet&gt;
      &lt;servlet-name&gt;servlet sensor&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;airQuality.CUAirQualitySensor&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;servlet sensor&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p>Here is my sample interface:</p>
  
  <pre><code>package airQuality.CUAirQualitySensor;
  import javax.ws.rs.GET;
  import javax.ws.rs.Path;
  import javax.ws.rs.Produces;
  import javax.ws.rs.core.MediaType;
  
  @Path("/AQSensor")
  @Produces(MediaType.TEXT_PLAIN)
  public interface CUManagerSensor {
  
      int getId();
      @GET
      @Path("/getQuality")
      String getQuality();
      @GET
      @Path("/getStateSensor")
      String getSensorState(int idS);
      String reduceEnergyConsumption(int id, String action);
  }
  </code></pre>
  
  <p>Here is my client code:</p>
  
  <pre><code>package airQUserAgent;
  
  import java.net.URI;
  
  import javax.ws.rs.client.Client;
  import javax.ws.rs.client.ClientBuilder;
  import javax.ws.rs.client.WebTarget;
  import javax.ws.rs.core.MediaType;
  import javax.ws.rs.core.UriBuilder;
  
  import org.glassfish.jersey.client.ClientConfig;
  public class UserImp {
      int id;
      public static void main(String[] args) {
          ClientConfig config = new ClientConfig();
  
          Client client = ClientBuilder.newClient(config);//Creating an Instance of a Client
  
          WebTarget target = client.target(getBaseURI());// Creating a WebTarget using the URI of the targeted web resource:
  
  
                 String response = target.path("AQSensor").path("getQuality").request().accept(MediaType.TEXT_PLAIN).get(String.class);
  
          System.out.println(response);
  
      }
       private static URI getBaseURI() {
              return UriBuilder.fromUri("http://localhost:8083/AirQuality").build();
          }
  
  }
  </code></pre>
  
  <p>On executing this class, I am getting the following exception:</p>
  
  <pre><code>Exception in thread "main" javax.ws.rs.NotFoundException: HTTP 404 Introuvable
      at org.glassfish.jersey.client.JerseyInvocation.convertToException(JerseyInvocation.java:917)
      at org.glassfish.jersey.client.JerseyInvocation.translate(JerseyInvocation.java:770)
      at org.glassfish.jersey.client.JerseyInvocation.access$500(JerseyInvocation.java:90)
      at org.glassfish.jersey.client.JerseyInvocation$2.call(JerseyInvocation.java:671)
      at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
      at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
      at org.glassfish.jersey.internal.Errors.process(Errors.java:228)
      at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:423)
      at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:667)
      at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:396)
      at org.glassfish.jersey.client.JerseyInvocation$Builder.get(JerseyInvocation.java:296)
      at airQUserAgent.UserImp.main(UserImp.java:25)
  </code></pre>
  
  <p>Can someone please let me know if I am missing something? Waht's the solution of this exception?
  Thanks.</p>