title: An exception in Grizzly unit test with Jersey
body: <p>I'm running <code>Unit Test</code> to test my <code>RESTful</code> web service run with <code>Grizzly</code>, and get the following exception.</p>
  
  <pre><code>javax.ws.rs.NotFoundException: HTTP 404 Not Found
      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:422)
      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 com.example.MyResourceTest.testGetIt(MyResourceTest.java:45)
  </code></pre>
  
  <p>The Unit Test</p>
  
  <pre><code>package com.example;
  
  import org.glassfish.grizzly.http.server.HttpServer;
  import org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory;
  import org.glassfish.jersey.server.ResourceConfig;
  import org.junit.After;
  import org.junit.Before;
  import org.junit.Test;
  
  import javax.ws.rs.client.Client;
  import javax.ws.rs.client.ClientBuilder;
  import javax.ws.rs.client.WebTarget;
  import javax.ws.rs.core.UriBuilder;
  import java.net.URI;
  
  import static org.junit.Assert.assertEquals;
  
  public class MyResourceTest {
      public static final URI BASE_URI = UriBuilder.fromUri("http://localhost").port(8080).build();
      private HttpServer server;
      private WebTarget target;
  
      @Before
      public void setUp() throws Exception {
  
          ResourceConfig rc = new ResourceConfig();
          server = GrizzlyHttpServerFactory.createHttpServer(BASE_URI, rc);
  
          server.start();
          Client c = ClientBuilder.newClient();
          target = c.target(BASE_URI);
      }
  
      @After
      public void tearDown() throws Exception {
          server.stop();
      }
  
      /**
       * Test to see that the message "Got it!" is sent in the response.
       */
      @Test
      public void testGetIt() {
          String responseMsg = target.path("myresource").request().get(String.class); // &lt;--- line 45 in exception!!!
          assertEquals("Got it!", responseMsg);
      }
  }
  </code></pre>
  
  <p>And the REST service</p>
  
  <pre><code>package com.example;
  
  import javax.ws.rs.GET;
  import javax.ws.rs.Path;
  import javax.ws.rs.Produces;
  import javax.ws.rs.core.MediaType;
  
  /**
   * Root resource (exposed at "myresource" path)
   */
  @Path("myresource")
  public class MyResource {
  
      @GET
      @Produces(MediaType.TEXT_PLAIN)
      public String getIt() {
          return "Got it!";
      }
  }
  </code></pre>
  
  <p>And <code>dependencies</code> from <code>POM.xml</code></p>
  
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;org.glassfish.jersey.containers&lt;/groupId&gt;
      &lt;artifactId&gt;jersey-container-servlet-core&lt;/artifactId&gt;
      &lt;version&gt;2.5.1&lt;/version&gt;
  &lt;/dependency&gt;
  
  &lt;dependency&gt;
      &lt;groupId&gt;org.glassfish.grizzly&lt;/groupId&gt;
      &lt;artifactId&gt;grizzly-http-server&lt;/artifactId&gt;
      &lt;version&gt;2.3.11&lt;/version&gt;
      &lt;scope&gt;test&lt;/scope&gt;
  &lt;/dependency&gt;
  
  &lt;dependency&gt;
      &lt;groupId&gt;junit&lt;/groupId&gt;
      &lt;artifactId&gt;junit&lt;/artifactId&gt;
      &lt;version&gt;4.11&lt;/version&gt;
      &lt;scope&gt;test&lt;/scope&gt;
  &lt;/dependency&gt;
  
  &lt;dependency&gt;
      &lt;groupId&gt;org.glassfish.jersey.containers&lt;/groupId&gt;
      &lt;artifactId&gt;jersey-container-grizzly2-http&lt;/artifactId&gt;
      &lt;version&gt;2.5.1&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>Thanks in advance!!! </p>