java.lang.ClassCastException: org.glassfish.jersey.jackson.internal.JacksonAutoDiscoverable cannot be cast to spi.AutoDiscoverable <p>I am new to implementing REST API services. I have tried the simple resources to implement. unfortunately I stuck with this exception. I have googled and tried many options but no luck. I am unsure what am doing wrong. Please help me.</p> <ol> <li>Created a Dynamic Web project "JersyJson"</li> <li>Created a resouce named - JSONService.java (source is from googling)</li> <li>Created a Java Bean class - Track.java (source is from googling)</li> <li>Converted the project into Maven project</li> <li>Created a Application file - JersyJson.java file for Application Annotation</li> <li>using the latest Jersy Jars (version: 2.22.2)</li> <li>Imported &amp; configured jersey-media-json-jackson and jersey-media-moxy jars (2.22.2) in pom.xml</li> </ol> <p><strong>Pom.xml</strong></p> <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt; &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt; &lt;groupId&gt;JersyJson&lt;/groupId&gt; &lt;artifactId&gt;JersyJson&lt;/artifactId&gt; &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt; &lt;packaging&gt;war&lt;/packaging&gt; &lt;dependencies&gt; &lt;dependency&gt; &lt;groupId&gt;javax.ws.rs&lt;/groupId&gt; &lt;artifactId&gt;javax.ws.rs-api&lt;/artifactId&gt; &lt;version&gt;2.0.1&lt;/version&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;org.glassfish.jersey.containers&lt;/groupId&gt; &lt;!-- if your container implements Servlet API older than 3.0, use "jersey-container-servlet-core" --&gt; &lt;artifactId&gt;jersey-container-servlet&lt;/artifactId&gt; &lt;version&gt;2.22.2&lt;/version&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;org.glassfish.jersey.media&lt;/groupId&gt; &lt;artifactId&gt;jersey-media-json-jackson&lt;/artifactId&gt; &lt;version&gt;2.22.2&lt;/version&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;org.glassfish.jersey.media&lt;/groupId&gt; &lt;artifactId&gt;jersey-media-moxy&lt;/artifactId&gt; &lt;version&gt;2.22.2&lt;/version&gt; &lt;/dependency&gt; &lt;/dependencies&gt; &lt;build&gt; &lt;sourceDirectory&gt;src&lt;/sourceDirectory&gt; &lt;plugins&gt; &lt;plugin&gt; &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt; &lt;version&gt;3.3&lt;/version&gt; &lt;configuration&gt; &lt;source&gt;1.8&lt;/source&gt; &lt;target&gt;1.8&lt;/target&gt; &lt;/configuration&gt; &lt;/plugin&gt; &lt;plugin&gt; &lt;artifactId&gt;maven-war-plugin&lt;/artifactId&gt; &lt;version&gt;2.6&lt;/version&gt; &lt;configuration&gt; &lt;warSourceDirectory&gt;WebContent&lt;/warSourceDirectory&gt; &lt;failOnMissingWebXml&gt;false&lt;/failOnMissingWebXml&gt; &lt;/configuration&gt; &lt;/plugin&gt; &lt;/plugins&gt; &lt;/build&gt; &lt;/project&gt; </code></pre> <p><strong>Web.xml</strong></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_3_0.xsd" id="WebApp_ID" version="3.0"&gt; &lt;display-name&gt;JersyJson&lt;/display-name&gt; &lt;servlet&gt; &lt;servlet-name&gt;javax.ws.rs.core.Application&lt;/servlet-name&gt; &lt;/servlet&gt; &lt;servlet-mapping&gt; &lt;servlet-name&gt;javax.ws.rs.core.Application&lt;/servlet-name&gt; &lt;url-pattern&gt;/json/metallica/*&lt;/url-pattern&gt; &lt;/servlet-mapping&gt; &lt;/web-app&gt; </code></pre> <p><strong>JersyJson.java (ApplicationAnnotation file)</strong></p> <pre><code>@ApplicationPath("json") public class JersyJson extends ResourceConfig { public JersyJson() { packages("com.sai.jersyjson"); } } </code></pre> <p><strong>JSONservice.java:</strong></p> <pre><code>package com.sai.jersyjson; 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; @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; } @POST @Path("/post") @Consumes(MediaType.APPLICATION_JSON) public Response createTrackInJSON(Track track) { String result = "Track saved : " + track; return Response.status(201).entity(result).build(); } } </code></pre> <p><strong>Track.java (simple bean class)</strong></p> <pre><code>package com.sai.jersyjson; public class Track { String title; String singer; public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getSinger() { return singer; } public void setSinger(String singer) { this.singer = singer; } @Override public String toString() { return "Track [title=" + title + ", singer=" + singer + "]"; } } </code></pre> <p><strong>After I run this project in Eclispe using Tomcat webserver, I get the following error with 404-Error Status</strong></p> <p>SEVERE: StandardWrapper.Throwable java.lang.ClassCastException: org.glassfish.jersey.jackson.internal.JacksonAutoDiscoverable cannot be cast to org.glassfish.jersey.internal.spi.AutoDiscoverable at org.glassfish.jersey.model.internal.CommonConfig$2.compare(CommonConfig.java:594) at java.util.TreeMap.put(Unknown Source) at java.util.TreeSet.add(Unknown Source) at java.util.AbstractCollection.addAll(Unknown Source) at java.util.TreeSet.addAll(Unknown Source) at org.glassfish.jersey.model.internal.CommonConfig.configureAutoDiscoverableProviders(CommonConfig.java:616) at org.glassfish.jersey.server.ResourceConfig.configureAutoDiscoverableProviders(ResourceConfig.java:811) at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:447) at org.glassfish.jersey.server.ApplicationHandler.access$500(ApplicationHandler.java:184) at org.glassfish.jersey.server.ApplicationHandler$3.call(ApplicationHandler.java:350) at org.glassfish.jersey.server.ApplicationHandler$3.call(ApplicationHandler.java:347) at org.glassfish.jersey.internal.Errors.process(Errors.java:315) at org.glassfish.jersey.internal.Errors.process(Errors.java:297) at org.glassfish.jersey.internal.Errors.processWithException(Errors.java:255) at org.glassfish.jersey.server.ApplicationHandler.(ApplicationHandler.java:347) at org.glassfish.jersey.servlet.WebComponent.(WebComponent.java:392) at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:177) at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:369) at javax.servlet.GenericServlet.init(GenericServlet.java:158) at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1238) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1041) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4996) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5285) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source)</p>