Reputation: 876
Within SpringSource Tool Suite I created a standard google app engine project. I added Jersey for REST support. The development server starts up fine, but when I try to GET a URL (e.g. http://localhost:8888/sibibjersey/api) I'm simply getting a 404. I suppose this is a simple configuration issue, but the solutions seems to hide away from me....
Here the main files:
web.xml looks like this.
<?xml version="1.0" encoding="utf-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
<init-param>
<param-name>com.sun.jersey.config.feature.DisableWADL</param-name>
<param-value>true</param-value>
</init-param>
<servlet>
<servlet-name>Jersey Web Application</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>com.sibib.main</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Jersey Web Application</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
I tried variations of the url-pattern like /* and /rest/*, but none seemed to work.
The only Java class in com.sibib.main is InfoResource.java:
package com.sibib.main;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
@Path("/api")
public class InfoResource {
@GET
public String info() {
return "Hello Jersey on Google App Engine";
}
}
I tried adding @Path to the info function, but no effect. When I start the server and navigate e.g. to http://localhost:8888/sibibjersey/api I'm simply getting a 404. Loading http://localhost:8888 loads the index.html in the war folder.
These are the lib referenced in the project:
Any hint is greatly appreciated!
Thanks!
Upvotes: 2
Views: 2755
Reputation: 2097
Can you try removing sibibjersey from the context path, just try with http: //localhost:8888/api In my local, I have not seen Google App Engine's application having project path along with http: //localhost:8888 I followed http://tugdualgrall.blogspot.com/2010/02/create-and-deploy-jax-rs-rest-service.html and it worked for me without any issues.
Upvotes: 7