在做SSM整合使用PageHelper时遇到的异常org.springframewor k.http.converter.HttpMessageNotWritableException

在做SSM整合使用PageHelper时遇到的异常

org.springframewor k.http.converter.HttpMessageNotWritableException

No converter found for return value of type: class com.github.pagehelper.Page
错误信息:没有找到为类(class com.github.pagehelper.Page)返回的值进行转化的转化器
在这里插入图片描述

找了很多篇文章总结大概有一下两种提示
1、依赖包jackson没有导入,或版本问题,
导入下面依赖:

<dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>2.9.5</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
            <version>2.9.5</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
            <version>2.9.5</version>
        </dependency>

执行依旧报着同样的错误。

2、实体类中的get,set方法没有写,这个我是写了的。

最后根据提示No converter没有转化器,排查到spring-web.xml文件中在写

<mvc:annotation-driven/>

时选错了命名空间。应该选

 xmlns:mvc="http://www.springframework.org/schema/mvc"
 http://www.springframework.org/schema/mvc
 http://www.springframework.org/schema/mvc/spring-mvc.xsd

而选用了

xmlns:mvc="http://www.alibaba.com/schema/stat"
http://www.alibaba.com/schema/stat 
http://www.alibaba.com/schema/stat.xsd

我们知道

<mvc:annotation-driven/>

是用来代替

<!--    处理器映射器-->
    <bean class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping"/>
<!--    处理器适配器-->
    <bean class="org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter"/>

这两句代码。
总而言之就是粗心出的错!!!!

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值