未找到提供程序类:运行 Jersey REST 示例应用程序时 [英] No provider classes found: when running Jersey REST example application

查看:32
本文介绍了未找到提供程序类:运行 Jersey REST 示例应用程序时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试过处理它.但是,由于我对此很陌生,所以无法弄清楚这个问题.我附上了几张截图来看看我现在面临的问题.

I tried working on it. But,not able to figure out the issue since I'm quite new to this. I have attached several screenshots to see the issue I'm facing right now.

@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();

}

}

推荐答案

没有提供者无关紧要,只是说明你没有.

The lack of providers is not relevant, it just means you don't have any.

您有一个 index.jsp,但是如果您将 Jersey 过滤器映射到上下文根 (/),则正确地说那里没有资源 - 根据您的屏幕截图,您只有一个资源,从 /emp 开始,其中包含用于更深路径的 CRUD 操作的子资源.

You have an index.jsp, but if you mapped the Jersey filter at the context root (/), it's rightfully saying there's no resource there - based on your screenshots you only have one resource, starting at /emp which has sub-resources for the CRUD operations at deeper paths.

再看一遍,您的 index.jsp 在 WEB-INF 中.我认为这不应该基于您似乎试图将一个简单的示例放在一起这一事实.

On second look, your index.jsp is in WEB-INF. I don't think it should be based on the fact you appear to be trying to get a simple example together.

那么,您希望在 /JerseyRESTCRUD/ 看到什么?

So, what do you expect to see at /JerseyRESTCRUD/?

这篇关于未找到提供程序类:运行 Jersey REST 示例应用程序时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆