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 (eg 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 eg 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!
您能尝试从上下文路径中删除sibibjersey吗,只需尝试使用http:// localhost:8888 / api在我的本地环境中,我还没有看到Google App Engine的应用程序具有http:// localhost:8888的项目路径,所以我遵循了http: //tugdualgrall.blogspot.com/2010/02/create-and-deploy-jax-rs-rest-service.html ,它对我没有任何问题。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.