Note that there are some explanatory texts on larger screens.

plurals
  1. PORESTEasy - javax.ws.rs.NotFoundException: Could not find resource for full path
    primarykey
    data
    text
    <p>I've tried to implement a REST service with RESTEasy in a GWT project, but when I get into the respective URI the application returns:</p> <pre><code>Grave: failed to execute javax.ws.rs.NotFoundException: Could not find resource for full path: http://127.0.0.1:8888/api/matches at org.jboss.resteasy.core.registry.ClassNode.match(ClassNode.java:73) at org.jboss.resteasy.core.registry.RootClassNode.match(RootClassNode.java:48) at org.jboss.resteasy.core.ResourceMethodRegistry.getResourceInvoker(ResourceMethodRegistry.java:444) at org.jboss.resteasy.core.SynchronousDispatcher.getInvoker(SynchronousDispatcher.java:234) at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:171) at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:220) at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56) at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) </code></pre> <p>My web.xml is:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt;&lt;web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.5" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"&gt; &lt;!-- All REST resources will be prefixed by /api --&gt; &lt;context-param&gt; &lt;param-name&gt;resteasy.servlet.mapping.prefix&lt;/param-name&gt; &lt;param-value&gt;/api&lt;/param-value&gt; &lt;/context-param&gt; &lt;!-- Servlets --&gt; &lt;servlet&gt; &lt;servlet-name&gt;Resteasy&lt;/servlet-name&gt; &lt;servlet-class&gt;org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher&lt;/servlet-class&gt; &lt;init-param&gt; &lt;param-name&gt;javax.ws.rs.Application&lt;/param-name&gt; &lt;param-value&gt;eii.api.MatchApplication&lt;/param-value&gt; &lt;/init-param&gt; &lt;/servlet&gt; &lt;!-- Servlet mappings --&gt; &lt;!-- All calls to /api/xxx will be sent to the reasy servlet --&gt; &lt;servlet-mapping&gt; &lt;servlet-name&gt;Resteasy&lt;/servlet-name&gt; &lt;url-pattern&gt;/api/*&lt;/url-pattern&gt; &lt;/servlet-mapping&gt; &lt;/web-app&gt; </code></pre> <p>The implementation of Application:</p> <pre><code>public class MatchApplication extends Application { private Set&lt;Object&gt; singletons = new HashSet&lt;Object&gt;(); private Set&lt;Class&lt;?&gt;&gt; classes = new HashSet&lt;Class&lt;?&gt;&gt;(); public MatchApplication() { singletons.add(new MatchServiceImpl()); } @Override public Set&lt;Class&lt;?&gt;&gt; getClasses() { return classes; } @Override public Set&lt;Object&gt; getSingletons() { return singletons; } } </code></pre> <p>And here's the class that provide the REST service:</p> <pre><code> /* Imports */ ... @Path("/matches") public class MatchResource { private static MatchResource _instance = null; private MatchRepository repository; public MatchResource() { repository = new MapMatchRepository(); } public static MatchResource getInstance() { if (_instance == null) _instance = new MatchResource(); return _instance; } @GET @Path("/{id}") @Produces("application/json") public Match getMatch(@PathParam("id") int id) { return repository.getMatch(id); } @GET @Produces("application/json") public Matches getMatchesCurrentRound() { return repository.getMatchesCurrentRound(); } ... } </code></pre> <p>What I want is to return a JSON file when getting into, for example: <code>http://127.0.0.1:8888/api/matches</code></p> <p>Does anyone know what I'm doing wrong?</p> <p><strong>Edit:</strong></p> <p>If I access to <code>http://127.0.0.1:8888/api/</code> or <code>http://127.0.0.1:8888/api/*</code> (where * is whatever you want to write), the browser shows nothing. However, if I access to <code>http://127.0.0.1:8888/oqiwn</code> (where <code>oqiwn</code> is a random string) the browser shows a <code>Error 404</code>.</p> <p>Also, I tried the RESTClient addon and these are the answers that returns:</p> <p>With <code>http://127.0.0.1:8888/api/</code> or <code>http://127.0.0.1:8888/api/*</code></p> <pre><code>Status Code: 404 Not Found Cache-Control: no-cache Content-Length: 0 Date: Sun, 10 Nov 2013 22:59:57 GMT Expires: Fri, 01 Jan 1990 00:00:00 GMT Server: Development/1.0 </code></pre> <p>And with <code>http://127.0.0.1:8888/oqiwn</code></p> <pre><code>Status Code: 404 Not Found Cache-Control: no-cache Content-Length: 83 Content-Type: text/html; charset=iso-8859-1 Date: Sun, 10 Nov 2013 22:59:05 GMT Expires: Fri, 01 Jan 1990 00:00:00 GMT Server: Development/1.0 </code></pre> <p>Note that <code>Content-Type: text/html; charset=iso-8859-1</code> is not in the first one.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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