title: Jersey Restful Services - Unable to connect to server
body: <p>I am learning to implement restful webservices with Jersey. I always get "POST </p>
  
  <pre><code>http://localhost:8080/rest/welcome/post 
  </code></pre>
  
  <p>returned a response status of 404 Not Found" - What is wrong with my code below? Context root on the server side is rest and I have @Path welcome at class level and @pPath post at method level.</p>
  
  <p><strong>Client</strong></p>
  
  <pre><code>public class WelcomeRestJsonClient {
  
      @Produces("application/json")
      @Consumes("text/plain")
      public void send() {
          MyObject myObject = new MyObject();
  
          ClientConfig clientConfig = new DefaultClientConfig();
          clientConfig.getClasses().add(com.restclient.MyJsonProvider.class);
          Client client = Client.create(clientConfig);
          WebResource webResource = client.resource("http://localhost:8080/rest/welcome/post");
          ClientResponse response = webResource.type(MediaType.APPLICATION_JSON).post(ClientResponse.class, myObject);
          System.out.println("success");
      }
  }
  </code></pre>
  
  <p><strong>Server</strong></p>
  
  <pre><code>@Path("/welcome")
  public class WelcomeRestJson {
  
      @POST
      @Path("/post")
      @Produces("text/plain")
      @Consumes("application/json")
  
      public String processPostData(MyObject myObject) {
          System.out.println("Inside processPostData");
          return "success";
      }
   }
  </code></pre>
  
  <p>Am I facing this problem because of incorrect JsonProvider configuration? On the client side, I am using MyJsonProvider which extends JacksonJaxbJsonProvider to convert MyObject to Json. My code on the server side simply accepts MyObject. Do I need some code to hook up Json provider on server side too? </p>
  
  <p>Here is my web.xml</p>
  
  <pre><code>&lt;servlet&gt;
      &lt;servlet-name&gt;Jersey REST Service&lt;/servlet-name&gt;
          &lt;servlet-class&gt;com.sun.jersey.spi.container.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;com.rest&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;Jersey REST Service&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/rest/*&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  
  &lt;welcome-file-list&gt;
      &lt;welcome-file&gt;index.html&lt;/welcome-file&gt;
  &lt;/welcome-file-list&gt;
  </code></pre>
  
  <p>I can access rest index.html. I see the following in the log file.
  INFO: Root resource classes found: class com.rest.WelcomeRestJson
  I removed "/" with the path. Still same 404 error. Please help.</p>