【发布时间】:2015-07-20 19:37:50
【问题描述】:
我正在关注Jersey tutorial 开发简单的 Jersey Web 应用程序。
通过以下部分 - 示例 2.9。使用 @ApplicationPath 和 Servlet 3.0 部署 JAX-RS 应用程序
我已经创建了以下程序:
@ApplicationPath("resources")
public class MyApplication extends PackagesResourceConfig {
public MyApplication() {
super("com.examples");
}
}
我有以下基本资源类:
@Path("/helloworld")
public class HelloWorldResource {
@GET
@Produces("text/plain")
public String getClichedMessage() {
return "Hello World";
}
}
我使用的是Jersey-1.19 版本,我的Web 应用程序中没有任何web.xml 文件。现在我正在 Tomcat 7 服务器上部署我的应用程序。
当我尝试以 http://localhost:8080/myapp/resources/helloworld 访问 URL 时,出现错误
HTTP 状态 404 - /myapp/resources/helloworld 输入状态报告
消息:/myapp/resources/helloworld
说明:请求的资源不可用。
【问题讨论】:
标签: java web-services rest tomcat jersey