Reputation: 1394
I am writing my very first REST application and starting with the basic maven archetype org.glassfish.jersey.archetypes jersey_quickstart_webapp 2.16.
I have created a new project as org.anthony.restJersey.messenger.
I have not made any edits to this project other than what is already defined as most of the trainings have me setup tomcat and try to run the webapp on it first. (I'm following JavaBrains.koushik.org). I am able to run the app on the Tomcat Server (7.0.52) in my Jave EE Eclipse (Version: Kepler Service Release 2 Build id: 20140224-0627). But when I try to click on the link "Jersey Resource" I get a 404 not found. Link being: http://localhost:8080/messenger/webapi/myresource.
The default code for MyResource.java is listed below:
package org.anthony.restJersey.messenger;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
/**
* Root resource (exposed at "myresource" path)
*/
@Path("myresource")
public class MyResource {
/**
* Method handling HTTP GET requests. The returned object will be sent
* to the client as "text/plain" media type.
*
* @return String that will be returned as a text/plain response.
*/
@GET
@Produces(MediaType.TEXT_PLAIN)
public String getIt() {
return "Got it!";
}
}
Upvotes: 2
Views: 1050
Reputation: 11
(If you have created single project that deployed on your newly created server,in your new workspace then only try following methods) Open the workspace and delete "servers" folder as well as in eclipse, delete configured server. Restart eclipse and create new server. I think it should solve the issue.
Upvotes: 0
Reputation: 1394
Created in a clean workspace and it works fine. Not sure of the original issue.
Upvotes: 1