title: JAX-RS, GlassFish, Eclipse. A simple web service doesn't work
body: <p>I am trying to run a simple "Hello World" RESTful web service on my machine. I use Eclipse Kepler and GlassFish 4.0. I am able to deploy the service and I see it on the admin pages of GlassFish but when I try to access to it I get the following error: "HTTP Status 404 - Not Found".</p>
  
  <p>Herein the code of the simple service:</p>
  
  <pre><code>import javax.ws.rs.Consumes;
  import javax.ws.rs.GET;
  import javax.ws.rs.PUT;
  import javax.ws.rs.Path;
  import javax.ws.rs.Produces;
  import javax.ws.rs.core.Context;
  import javax.ws.rs.core.UriInfo;
  
  @Path("hello")
  public class HelloRest {
      @SuppressWarnings("unused")
      @Context
      private UriInfo context;
  
      /**
       * Default constructor. 
       */
      public HelloRest() {
          // TODO Auto-generated constructor stub
      }
  
      /**
       * Retrieves representation of an instance of HelloRest
       * @return an instance of String
       */
      @GET
      @Produces("application/xml")
      public String getXml() {
          // TODO return proper representation object
          return "&lt;greeting&gt;Hello REST&lt;/greeting&gt;";
      }
  
      /**
       * PUT method for updating or creating an instance of HelloRest
       * @param content representation for the resource
       * @return an HTTP response with content of the updated or created resource.
       */
      @PUT
      @Consumes("application/xml")
      public void putXml(String content) {
      }
  
  }
  </code></pre>
  
  <p>In order to access to the service I try the following URL: <code>http://127.0.0.1:8080/hello-rest/hello</code>, where <code>hello-rest</code> is the name of the Eclipse project and the root path suggested by the admin page of GlassFish.</p>