title: Jersey REST Web Service, Tomcat, Eclipse and 404's
body: <p>I've read through a number of posts, but just can't seem to solve my problem.  You'll also see tons of posts very similar to this one, even the same tutorial.  Even following them, I can't seem to get to the answer.</p>
  
  <p>Essentially, I'm trying to follow the simple tutorial at: <a href="http://www.vogella.com/articles/REST/">http://www.vogella.com/articles/REST/</a></p>
  
  <p>I've made a few changes to make it compatible with Jersey 2.x</p>
  
  <p>I'm using: 
     Eclipse
     Tomcat 6 (Deployed/Run as within Eclipse)
     jaxrs-ri-2.0
     I've enabled the JAX-RS Facet in Eclipse</p>
  
  <p>Everything builds fine
  Tomcat starts fine within Eclipse
  I can get to a static page content via: </p>
  
  <p><code>http://localhost:8080/RestTEST2/index.html</code></p>
  
  <p>However, when I try to access my service via: </p>
  
  <p><code>http://localhost:8080/RestTEST2/jaxrs/hello</code> </p>
  
  <p>I receive a 404 with "message not found" and "The requested resource (Not Found) is not available."</p>
  
  <p>Here is my web.xml which is located at /WebContent/WEB-INF/web.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &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_2_5.xsd" id="WebApp_ID" version="2.5"&gt;
  &lt;display-name&gt;TestREST2&lt;/display-name&gt;
  &lt;welcome-file-list&gt;
      &lt;welcome-file&gt;index.html&lt;/welcome-file&gt;
  &lt;/welcome-file-list&gt;
  &lt;servlet&gt;
    &lt;description&gt;JAX-RS Tools Generated - Do not modify&lt;/description&gt;
    &lt;servlet-name&gt;JAX-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;com.sun.jersey.config.property.packages&lt;/param-name&gt;
        &lt;param-value&gt;TestREST&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;JAX-RS Servlet&lt;/servlet-name&gt;
        &lt;url-pattern&gt;/jaxrs/*&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p>Here is my Java class:</p>
  
  <pre><code>package TestREST;
  
  import javax.ws.rs.GET;
  import javax.ws.rs.Path;
  import javax.ws.rs.Produces;
  import javax.ws.rs.core.MediaType;
  
  // Plain old Java Object it does not extend as class or implements 
  // an interface
  
  // The class registers its methods for the HTTP GET request using the @GET annotation. 
  // Using the @Produces annotation, it defines that it can deliver several MIME types,
  // text, XML and HTML. 
  
  // The browser requests per default the HTML MIME type.
  
  //Sets the path to base URL + /hello
  @Path("/hello")
  public class Hello {
  
    // This method is called if TEXT_PLAIN is request
    @GET
    @Produces(MediaType.TEXT_PLAIN)
    public String sayPlainTextHello() {
      return "Hello Jersey";
    }
  
    // This method is called if XML is request
    @GET
    @Produces(MediaType.TEXT_XML)
    public String sayXMLHello() {
      return "&lt;?xml version=\"1.0\"?&gt;" + "&lt;hello&gt; Hello Jersey" + "&lt;/hello&gt;";
    }
  
    // This method is called if HTML is request
    @GET
    @Produces(MediaType.TEXT_HTML)
    public String sayHtmlHello() {
      return "&lt;html&gt; " + "&lt;title&gt;" + "Hello Jersey" + "&lt;/title&gt;"
          + "&lt;body&gt;&lt;h1&gt;" + "Hello Jersey" + "&lt;/body&gt;&lt;/h1&gt;" + "&lt;/html&gt; ";
    }   
  } 
  </code></pre>
  
  <p>I also have a JAX-RS User Library configured and referenced that includes all the JAX-RS jars.</p>
  
  <p>Thoughts on what would cause the web service to not be found?</p>