异常问题解决记录

 一、mybatis

Caused by: java.lang.annotation.AnnotationFormatError: Invalid default: public abstract java.lang.Class org.mybatis.spring.annotation.MapperScan.factoryBean()

 解决方案:

        <!-- https://mvnrepository.com/artifact/org.springframework.data/spring-data-commons -->
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-commons</artifactId>
            <version>1.13.7.RELEASE</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.springframework/spring-orm -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-orm</artifactId>
            <version>4.3.14.RELEASE</version>
        </dependency>

Q:Unknown initial character set index '224' received from server

解决方案:数据库链接URL中增加"?useUnicode=true&amp;characterEncoding=utf8"

Q:org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1

解决方案:检查文件编码without BOM,除此之外,可能是mybatis-config.xml中的mapper路径写错了。

Q:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)

解决方案:<=需要使用&lt;=

 @Select(
            "<script>" +
            "select " +
            "business_field_id,business_field_identifier,business_field_name,business_field_comment,business_field_value,business_field_value_cn " +
            "from t_a " +
            "where event_id = #{eventId} " +
            "and page_id = #{pageId} " +
            "<if test=\"showChannelId != null and showChannelId != '' \">" +
            "and show_channel_id = #{showChannelId} " +
            "</if>" +
            "and business_field_value_rank &lt;= 100 " +
            "order by business_field_id,business_field_value_rank " +
            "</script>"
    )

Q:分组元素不可重复,否则运行抛出异常

//java.lang.IllegalStateException
Map<Integer, AppPageInfo> appPageInfoMap = appPageInfoList.stream().collect(Collectors.toMap(AppPageInfo::getPageId, Function.identity()));

Q:ERROR Error 1071: Specified key was too long; max key length is 3072 bytes

https://www.cnblogs.com/jimmyfan/p/12673177.html

常见编程bug

  • 表权限没有申请
  • 没有将元素加入列表list +1
  • mysql mapper @Param与xml不一致
  • xml中的表名没有修改
  • 错误返回对象中的中文名,应该返回英文名
  • batchInsert传入的是空列表
  • org.apache.ibatis.binding.BindingException: Invalid bound statement (not found) 因为在foreach里面分隔时多写了一个逗号。 +1
  • 前端显示的数据缺少,需要从直接的数据表全集确认下,因为查询语句可能存在limit操作。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值