"Cannot resolve PropertyFilter with id" error when immediately returning the Response inside a Jersey Rest method

30 Views Asked by At

I am using Jersey 2.35. Here are 2 different methods for a rest web service, using jersey :

   @GET
   @Produces({"application/prs.department.multiple.v1+json"})
public Response getDepartments1()
    {              
        Response response;
        List<Department> lDepartment = departmentservice.getAll();
        response = Response
            .status(Response.Status.OK)
            .entity(lDepartment)
            .build();        
        return response;
    }
   @GET
   @Produces({"application/prs.department.multiple.v1+json"})
public Response getDepartments2()
    {              
       List<Department> lDepartment = departmentservice.getAll();
        return Response
            .status(Response.Status.OK)
            .entity(lDepartment)
            .build();    
    }

The first one (getDepartments1()) works. If i comment out the first one and test the second one (getDepartments2()), it produces the following error:

Cannot resolve PropertyFilter with id 'com.mycompany.entity.Department'; no FilterProvider configured (through reference chain: java.util.ArrayList[0])

Why is that ?

0

There are 0 best solutions below