泽西岛抛出错误的请求异常(400)

Jersey throws Bad request exception(400)

当试图从数据库中获取单条记录时,球衣抛出错误请求exception.Kindly有人帮我解决这个问题。

Ajax :-

     var id = $(this).attr("data-id").trim();
    $.ajax({
        url:"./scalegdn/service/getServiceById/"+id,
        method:"get",
        dataType:"json",
        success:function(data){
            $("#servicename").val(data.serviceName);
            $("#description").val(data.serviceDescription);
        }
    });

球衣资源:-

@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/getServiceById/{id}")
public ServiceTO getServiceById(@PathParam("id") int id) throws Exception {
    ServiceDAO servicedao = null;
    ServiceTO service=null;
    logger.info("id is:"+id);
    try {
        service=servicedao.getServiceById(id);
    } catch (Exception e) {
        logger.error("Error occurs,While trying to get service by serviceId.",e);
    } finally {
        if (!connection.isClosed()) {
            connection.close();
        }
    }
    return service;
}

检查您导入的@PathParam 包。尝试使用球衣依赖。