Run application in apache localhost:8080
<p>I have to run java URL="http://localhost:8080/RESTfulExample/rest/json/metallica/get" on Apache Tomcat but i am getting 404 Error. i want to get json response so what am i doing?</p>

<pre><code>@Path("/json/metallica")
public class JSONService {

    @GET
    @Path("/get")
    @Produces(MediaType.APPLICATION_JSON)
    public Track getTrackInJSON() {

        Track track = new Track();
        track.setTitle("Enter Sandman");
        track.setSinger("Metallica");

        return track;

    }

public class NetClientGet {


    public static void main(String[] args) {

        try {

            URL url = new URL(
                    "http://localhost:8080/RESTfulExample/rest/json/metallica/get");
            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
            conn.setRequestMethod("GET");
            conn.setRequestProperty("Accept", "application/json");



            BufferedReader br = new BufferedReader(new InputStreamReader(
                    (conn.getInputStream())));

            String output;
            System.out.println("Output from Server .... \n");
            while ((output = br.readLine()) != null) {

                System.out.println(output);
            }

            conn.disconnect();

        } catch (MalformedURLException e) {

            e.printStackTrace();
        } catch (IOException e) {

            e.printStackTrace();

        }

    }

}
</code></pre>

<p>Exception :</p>

<blockquote>
  <p>java.lang.RuntimeException: Failed : HTTP error code : 404    at
  com.mkyong.client.JerseyClientPost.main(JerseyClientPost.java:24)</p>
</blockquote>

<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;jersey-serlvet&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.mkyong.rest&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-serlvet&lt;/servlet-name&gt;
        &lt;url-pattern&gt;/rest/&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;

&lt;/web-app&gt;
</code></pre>