Note that there are some explanatory texts on larger screens.

plurals
  1. POJersey service not found with recent version
    text
    copied!<p>I wanted to test a simple "Hello World" jersey service using Maven and Tomcat (7.0) in Eclipse. Maven downloaded the most recent version 1.17, but everytime I try to access the page I retreive a 404. However after changing back to version 1.9 it works as expected. Did anything change between those version or am I missing something?</p> <p>What I do is calling <code>localhost:8080/rngservice/rest/hello</code> which gives a 404 error when I'm using jersey versions beyond 9. Using version 9 however works as intended and returns the HTML page.</p> <p>Any suggestions?</p> <p>My code:</p> <pre><code>package service.test; import javax.ws.rs.*; @Path("/hello") public class RNGResource { @GET @Produces(MediaType.TEXT_HTML) public String getItHTML() { return "&lt;htm&gt; &lt;title&gt; " + "Got it!" + "&lt;/title&gt; &lt;/html&gt;"; } } </code></pre> <p>I don't use a web.xml but a <code>PackagesResourceConfig</code> for the servlet configuration</p> <pre><code>package service.test; import javax.ws.rs.ApplicationPath; import com.sun.jersey.api.core.PackagesResourceConfig; @ApplicationPath("/rest/*") public class RNGServiceApplication extends PackagesResourceConfig { public RNGServiceApplication() { super("service.test"); } } </code></pre> <p>The Maven .pom</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/maven-v4_0_0.xsd"&gt; &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt; &lt;groupId&gt;service&lt;/groupId&gt; &lt;artifactId&gt;rngservice&lt;/artifactId&gt; &lt;packaging&gt;war&lt;/packaging&gt; &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt; &lt;name&gt;rngservice&lt;/name&gt; &lt;build&gt; &lt;!-- ... --&gt; &lt;/build&gt; &lt;dependencies&gt; &lt;dependency&gt; &lt;groupId&gt;asm&lt;/groupId&gt; &lt;artifactId&gt;asm&lt;/artifactId&gt; &lt;version&gt;3.1&lt;/version&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;javax.ws.rs&lt;/groupId&gt; &lt;artifactId&gt;jsr311-api&lt;/artifactId&gt; &lt;version&gt;1.1&lt;/version&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;com.sun.jersey&lt;/groupId&gt; &lt;artifactId&gt;jersey-core&lt;/artifactId&gt; &lt;version&gt;1.17&lt;/version&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;com.sun.jersey&lt;/groupId&gt; &lt;artifactId&gt;jersey-server&lt;/artifactId&gt; &lt;version&gt;1.17&lt;/version&gt; &lt;/dependency&gt; &lt;/dependencies&gt; &lt;/project&gt; </code></pre>
 

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