title: Test case for testing a jersey web resource using grizzle is giving me 404
body: <p>I tried below way which is working fine</p>
  
  <pre><code>package test;
  
  import static org.junit.Assert.assertEquals;
  
  import javax.ws.rs.GET;
  import javax.ws.rs.Path;
  import javax.ws.rs.core.Application;
  
      import org.glassfish.jersey.server.ResourceConfig;
      import org.glassfish.jersey.test.DeploymentContext;
      import org.glassfish.jersey.test.JerseyTest;
      import org.glassfish.jersey.test.ServletDeploymentContext;
      import org.glassfish.jersey.test.grizzly.GrizzlyWebTestContainerFactory;
      import org.glassfish.jersey.test.spi.TestContainerException;
      import org.glassfish.jersey.test.spi.TestContainerFactory;
      import org.junit.Test;
  
      import com.mkyong.rest.HelloWorldService;
  
      public class HelloWorldServiceTest extends JerseyTest{
  
          @Path("hello")
          public static class HelloResource {
              @GET
              public String getHello() {
                  return "Hello World!";
              }
          }
  
          @Override
          protected Application configure() {
              return new ResourceConfig(HelloResource.class);
          }
  
          @Override
          protected TestContainerFactory getTestContainerFactory() throws TestContainerException {
              return new GrizzlyWebTestContainerFactory();
          }
  
          @Override
          protected DeploymentContext configureDeployment() {
              return ServletDeploymentContext.forPackages(
                      getClass().getPackage().getName()).build();
          }
  
          @Test
          public void testSingleNode() throws Exception {
              final String hello = target("hello").request().get(String.class);
              assertEquals("Hello World!", hello);
          }
          }
  </code></pre>
  
  <p>When i tried to replace the resource with resource which is outside of this test class and package like below</p>
  
  <pre><code>   package test;
  
  import static org.junit.Assert.assertEquals;
  
  import javax.ws.rs.GET;
  import javax.ws.rs.Path;
  import javax.ws.rs.core.Application;
  
  import org.glassfish.jersey.server.ResourceConfig;
  import org.glassfish.jersey.test.DeploymentContext;
  import org.glassfish.jersey.test.JerseyTest;
  import org.glassfish.jersey.test.ServletDeploymentContext;
  import org.glassfish.jersey.test.grizzly.GrizzlyWebTestContainerFactory;
  import org.glassfish.jersey.test.spi.TestContainerException;
  import org.glassfish.jersey.test.spi.TestContainerFactory;
  import org.junit.Test;
  
  import com.mkyong.rest.HelloWorldService;
  
  public class HelloWorldServiceTest extends JerseyTest{
  
      @Path("hello")
      public static class HelloResource {
          @GET
          public String getHello() {
              return "Hello World!";
          }
      }
  
      @Override
      protected Application configure() {
          return new ResourceConfig(HelloWorldService.class);
      }
  
      @Override
      protected TestContainerFactory getTestContainerFactory() throws TestContainerException {
          return new GrizzlyWebTestContainerFactory();
      }
  
      @Override
      protected DeploymentContext configureDeployment() {
          return ServletDeploymentContext.forPackages(
                  getClass().getPackage().getName()).build();
      }
  
      @Test
      public void testSingleNode() throws Exception {
          final String hello = target("hello").path("Test").request().get(String.class);
          assertEquals("Jersey say : Test", hello);
      }
      }
  </code></pre>
  
  <p>HelloWorldService.java</p>
  
  <pre><code>package com.mkyong.rest;
  
  import javax.ws.rs.GET;
  import javax.ws.rs.Path;
  import javax.ws.rs.PathParam;
  import javax.ws.rs.Produces;
  import javax.ws.rs.core.MediaType;
  import javax.ws.rs.core.Response;
  
  @Path("/hello")
  public class HelloWorldService {
  
      @GET
      @Path("/{param}")
      @Produces(MediaType.APPLICATION_JSON)
      public Response getMsg(@PathParam("param") String msg) {
  
          String output = "Jersey say : " + msg;
  
          return Response.status(200).entity(output).build();
  
      }
  
  }
  </code></pre>
  
  <p>RestApplication.java</p>
  
  <pre><code>      package rest;
  
  import java.util.HashSet;
  import java.util.Set;
  
  import javax.ws.rs.core.Application;
  
  import com.mkyong.rest.HelloWorldService;
  
  public class RestApplication extends Application{
  
        @Override
          public Set&lt;Class&lt;?&gt;&gt; getClasses() {
              Set&lt;Class&lt;?&gt;&gt; s = new HashSet&lt;Class&lt;?&gt;&gt;();
  
              s.add(HelloWorldService.class);
              return s;
          }
  
  
  }
  </code></pre>
  
  <p>web.xml</p>
  
  <pre><code>&lt;web-app id="WebApp_ID" version="2.4"
      xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
      http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"&gt;
      &lt;display-name&gt;Restful Web Application&lt;/display-name&gt;
  
       &lt;servlet&gt;
      &lt;servlet-name&gt;rs-servlet&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;javax.ws.rs.Application&lt;/param-name&gt;
      &lt;param-value&gt;rest.RestApplication&lt;/param-value&gt;
  &lt;/init-param&gt;
    &lt;/servlet&gt;
    &lt;servlet-mapping&gt;
    &lt;servlet-name&gt;rs-servlet&lt;/servlet-name&gt;
    &lt;url-pattern&gt;/rest/*&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  
  &lt;/web-app&gt;
  </code></pre>
  
  <p>I got an 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: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 test.HelloWorldServiceTest.testSingleNode(HelloWorldServiceTest.java:48) 
  </code></pre>
  
  <p>Can any one correct me where i went wrong...   </p>