找不到提供程序类:运行Jersey REST示例应用程序时

时间:2013-03-14 13:04:20

标签: rest jersey

我尝试过它。但是,因为我对此很陌生,所以无法弄清楚这个问题。我附上了几个屏幕截图,看看我现在面临的问题。

enter image description here

enter image description here

enter image description here

enter image description here

@Path("/emp")
public class EmployeeService {

@GET
@Path("/emp/{empID}")
@Produces(MediaType.APPLICATION_XML)
public Employee getEmployee(@PathParam(value = "empID") String empID) {
    Employee employee = new Employee();
    employee.setEmailId(empID);
    employee.setName("Rony John");
    employee.setEmailId("rony.java@gmail.com");
    return employee;
}

@POST
@Path("/create")
@Consumes(MediaType.APPLICATION_XML)
@Produces(MediaType.APPLICATION_XML)
public Employee createEmployee(Employee employee) {
    // Create logic
    return employee;

}

@POST
@Path("/update")
@Consumes(MediaType.APPLICATION_XML)
@Produces(MediaType.APPLICATION_XML)
public Employee updateEmployee(Employee employee) {
    employee.setName(employee.getName() + " updated");
    return employee;
}

@DELETE
@Path("/delete/{empID}")
public Response deleteEmployee(@PathParam(value = "empID") String empID) {
    return Response.status(200)
            .entity("Employee with " + empID + " is deleted successfully.")
            .build();

}

}

1 个答案:

答案 0 :(得分:4)

缺乏提供者并不重要,只是意味着你没有。

你有一个index.jsp,但是如果你在上下文根(/)映射了Jersey过滤器,它就是说没有资源 - 基于你的截图,你只有一个资源,从{{1开始其中有更深层路径的CRUD操作的子资源。

编辑:第二眼看,你的/emp在WEB-INF中。我不认为它应该基于你似乎试图一起得到一个简单例子的事实。

那么,您期望在index.jsp看到什么?