Note that there are some explanatory texts on larger screens.

plurals
  1. POJava Jersey Rest : No provider classes found. (404 error when accessing URL)
    text
    copied!<blockquote> <p><strong>Edit:</strong> I hadn't realized that all request were first going into "Apache" and then were redirected to Tomcat. I added a new redirection in the <code>apache2.conf</code> file. See the <a href="https://stackoverflow.com/a/6597100">accepted answer</a> for details.</p> </blockquote> <p>I am having the exact same problem as this question. <a href="https://stackoverflow.com/questions/6111074/jersey-rest-the-resourceconfig-instance-does-not-contain-any-root-resource-classe">Jersey REST The ResourceConfig instance does not contain any root resource classes</a> However the user never answered the question.</p> <p>I am using Tomcat, without maven. I followed this tutorial. <a href="http://www.ibm.com/developerworks/web/library/wa-aj-tomcat/index.html" rel="nofollow noreferrer">http://www.ibm.com/developerworks/web/library/wa-aj-tomcat/index.html</a></p> <p>I made changes to web.xml as per the article<br> i.e the new servlet and servlet mapping was created with the correct package name.</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;sample.hello.resources&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; </code></pre> <p>I have deployed the following jars to tomcat</p> <pre><code>asm.jar jersey-server.jar jersey-core.jar jsr311.jar </code></pre> <p>The tomcat startup log has the following exceptions.</p> <pre><code> com.sun.jersey.api.core.PackagesResourceConfig init INFO: Scanning for root resource and provider classes in the packages: sample.hello.resources com.sun.jersey.api.core.ScanningResourceConfig logClasses INFO: Root resource classes found: class sample.hello.resources.HelloResource com.sun.jersey.api.core.ScanningResourceConfig init INFO: No provider classes found. com.sun.jersey.server.impl.application.WebApplicationImpl _initiate INFO: Initiating Jersey application, version 'Jersey: 1.8 06/24/2011 12:17 PM' </code></pre> <p>When I access the URL I get a 404. <a href="http://localhost:8080/Jersey/rest/hello" rel="nofollow noreferrer">http://localhost:8080/Jersey/rest/hello</a></p> <p>The code:</p> <pre><code>import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; @Path("/hello") public class HelloResource { @GET @Produces(MediaType.TEXT_PLAIN) public String sayHello() { return "Hello Jersey"; } } </code></pre> <p>I do not see any other exceptions in the logs</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload