title: FileNotFoundException when invoking RESTful service
body: <p>A simple REST invocation I have set up is giving me a file-not-found exception when running. I've looked up the error and know that the URL isn't finding anything, but I can't figure out why. The REST servlet seems to me to be set up just fine yet somehow the URL isn't mapping to the actions implemented inside it. A similar tutorial project works perfectly, but not this one, even though they're configured in almost exactly the same way:</p>
  
  <p>Output:</p>
  
  <pre><code>{"username":"AchillesV3","password":"affirmation","email":"jason@cave-gaming.com"}
  
  Error while calling Crunchify REST Service
  java.io.FileNotFoundException: http://localhost:8080/arenamaster-backend/api/player/post
  java.io.FileNotFoundException: http://localhost:8080/arenamaster-backend/api/player/post
      at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1890)
      at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
      at RESTServiceClient.main(RESTServiceClient.java:43)
  </code></pre>
  
  <p>PlayerService.java</p>
  
  <pre><code>package services;
  
  import javax.ws.rs.Consumes;
  import javax.ws.rs.GET;
  import javax.ws.rs.POST;
  import javax.ws.rs.Path;
  import javax.ws.rs.Produces;
  import javax.ws.rs.core.MediaType;
  import javax.ws.rs.core.Response;
  
  import org.springframework.web.bind.annotation.CrossOrigin;
  
  import objects.*;
  
  @Path("/player")
  public class PlayerService {
  
      @GET
      @Path("/get")
      @Produces(MediaType.TEXT_PLAIN)
      //@CrossOrigin
      public String getTestString() {
  
          return "Get success";
  
      }
  
      @POST
      @Path("/post")
      //@CrossOrigin
      @Consumes(MediaType.APPLICATION_JSON)
      public Response registerNewPlayer(PlayerRegisterRequest new_player) {
  
          String result = "Player saved : " + new_player;
          return Response.status(201).entity(result).build();
  
      }
  
  }
  </code></pre>
  
  <p>Rest Client:</p>
  
  <pre><code>import java.io.BufferedReader;
  import java.io.FileInputStream;
  import java.io.InputStream;
  import java.io.InputStreamReader;
  import java.io.OutputStreamWriter;
  import java.net.URL;
  import java.net.URLConnection;
  
  import org.codehaus.jettison.json.JSONObject;
  
  public class RESTServiceClient {
      public static void main(String[] args) {
          String string = "";
          try {
  
              // Step1: Let's 1st read file from fileSystem
              // Change CrunchifyJSON.txt path here
              InputStream crunchifyInputStream = new FileInputStream("JSON.txt");
              InputStreamReader crunchifyReader = new InputStreamReader(crunchifyInputStream);
              BufferedReader br = new BufferedReader(crunchifyReader);
              String line;
              while ((line = br.readLine()) != null) {
                  string += line + "\n";
              }
  
              JSONObject jsonObject = new JSONObject(string);
              System.out.println(jsonObject);
  
              // Step2: Now pass JSON File Data to REST Service
              try {
                  URL url = new URL("http://localhost:8080/arenamaster-backend/api/player/post");
                  URLConnection connection = url.openConnection();
                  connection.setDoOutput(true);
                  connection.setDoInput(true);
                  connection.setRequestProperty("Content-Type", "application/json");
                  connection.setConnectTimeout(5000);
                  connection.setReadTimeout(5000);
                  OutputStreamWriter out = new OutputStreamWriter(connection.getOutputStream());
                  out.write(jsonObject.toString());
                  out.close();
  
                  BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
  
                  String line_in;
  
                  while ((line_in = in.readLine()) != null) {
                      System.out.println(line_in);
                  }
                  System.out.println("\nCrunchify REST Service Invoked Successfully..");
                  in.close();
              } catch (Exception e) {
                  System.out.println("\nError while calling Crunchify REST Service");
                  e.printStackTrace();
                  System.out.println(e);
              }
  
              br.close();
          } catch (Exception e) {
              e.printStackTrace();
          }
  
  
      }
  }
  </code></pre>
  
  <p>web.xml</p>
  
  <pre><code>&lt;!DOCTYPE web-app PUBLIC
   "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
   "http://java.sun.com/dtd/web-app_2_3.dtd" &gt;
  
  &lt;web-app&gt;
    &lt;display-name&gt;Archetype Created Web Application&lt;/display-name&gt;
  
    &lt;servlet&gt;
      &lt;servlet-name&gt;jersey-servlet&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;services&lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;com.sun.jersey.api.json.POJOMappingFeature&lt;/param-name&gt;
          &lt;param-value&gt;true&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-servlet&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/api/*&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
  
  &lt;/web-app&gt;
  </code></pre>