Spring MVC中ajax GET请求的内部服务器错误

Spring MVC中ajax GET请求的内部服务器错误,ajax,spring,hibernate,spring-mvc,Ajax,Spring,Hibernate,Spring Mvc,大家好,我是SpringMVC的新手,所以我对这个框架知之甚少。我所要做的就是用hibernate查询过滤的项刷新视图中的div,该查询将正确打印到标准输出 由于某种原因,我没有意识到我得了500分;尝试通过ajax获取请求时出现内部服务器错误。 我更改了控制器中的返回类型,我最初的想法是使用带有可选参数的默认索引控制器 视图: 控制器: @RequestMapping(value = "/filterItems", method = RequestMethod.GET) public

大家好,我是SpringMVC的新手,所以我对这个框架知之甚少。我所要做的就是用hibernate查询过滤的项刷新视图中的div,该查询将正确打印到标准输出

由于某种原因,我没有意识到我得了500分;尝试通过ajax获取请求时出现内部服务器错误。 我更改了控制器中的返回类型,我最初的想法是使用带有可选参数的默认索引控制器

视图:

控制器:

@RequestMapping(value = "/filterItems", method = RequestMethod.GET)
    public @ResponseBody List<Item> filterItems(@RequestParam(value = "type", required = false) String type) {
        List<Item> items = new ArrayList<Item>();
        try {
            items = itemDao.getItems(type);

        } catch (Exception e) {
            e.printStackTrace();
        }        
        return items;
    }
@RequestMapping(value=“/filteriems”,method=RequestMethod.GET)
public@ResponseBody列表过滤器项(@RequestParam(value=“type”,required=false)字符串类型){
列表项=新建ArrayList();
试一试{
items=itemDao.getItems(类型);
}捕获(例外e){
e、 printStackTrace();
}        
退货项目;
}

任何帮助都将不胜感激。提前谢谢

再一次,当谈到我对hibernate的小小体验时,这个错误与Javascript、控制器o DAO无关,而是与实体映射有关


我的项目实体与一个用户实体有关联,并且必须指定关联的延迟加载和渴望加载。在我的例子中,通过将
lazy=“true”
添加到我的xml文件中解决了这个问题。

再一次,当谈到我对hibernate的小小体验时,这个错误与Javascript、控制器o DAO无关,而是与实体映射有关


我的项目实体与一个用户实体有关联,并且必须指定关联的延迟加载和渴望加载。在我的例子中,通过将
lazy=“true”
添加到我的xml文件中解决了这个问题。

请包括相关的stacktrace。“服务器遇到了一个内部错误,导致它无法满足此请求”。从eclipse控制台中我看不到任何异常。我很乐意粘贴catalina.out日志条目,但我不知道在Mac OSXPlease中哪里可以找到这些条目。请包含相关的stacktrace。“服务器遇到了一个内部错误,使其无法满足此请求”。从eclipse控制台中我看不到任何异常。我很乐意粘贴catalina.out日志条目,但我不知道在MacOSX中哪里可以找到这些条目
function filterItems(value) {

    $("#itemListContainer").empty();

        $.ajax({
            method: "GET",
            //dataType: "json",
            url: "filterItems.htm",
            data: {
                type: value
            },                
            success: function (data) {
                if (data) { 
                    $("#itemListContainer").html(data);                    
                } else {
                    console.log(xhr.responseText);
                    alert("failure");
                }    
            }, 
            error: function(XMLHttpRequest, textStatus, errorThrown) { 
                alert("Status: " + textStatus); alert("Error: " + errorThrown); 
            }     
        });
}
@RequestMapping(value = "/filterItems", method = RequestMethod.GET)
    public @ResponseBody List<Item> filterItems(@RequestParam(value = "type", required = false) String type) {
        List<Item> items = new ArrayList<Item>();
        try {
            items = itemDao.getItems(type);

        } catch (Exception e) {
            e.printStackTrace();
        }        
        return items;
    }