最近遇到的一些异常和解决方法

1、java.lang.ClassCastException: com.chenggutek.iou.rest.modular.comm.entity.MsgUser cannot be cast to (转换异常)com.baomidou.mybatisplus.plugins.Page

    at com.sun.proxy.$Proxy90.getPageMsgTrade(Unknown Source) ~[na:na]

 

2、org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter 'app_user_id' not found. Available parameters are [appUserId, param1]

原因:xml文件中,param参数错误,不对应和Mapper.java

 

3、org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.TooManyResultsException: Expected one result (or null) to be returned by selectOne(), but found: 2(结果应该为一个,但是却查到了两个)

    at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:77) ~[mybatis-spring-1.3.1.jar:1.3.1]

 

4、org.springframework.dao.TransientDataAccessResourceException:

### Error updating database.  Cause: java.sql.SQLException: Connection is read-only. Queries leading to data modification are not allowed

### The error may involve com.chenggutek.iou.rest.modular.pay.dao.PayOrderMapper.insert-Inline

### The error occurred while setting parameters

### SQL: INSERT INTO tbl_pay_order   ( trade_id )  VALUES   ( ? )

### Cause: java.sql.SQLException: Connection is read-only. Queries leading to data modification are not allowed

; SQL []; Connection is read-only. Queries leading to data modification are not allowed; nested exception is java.sql.SQLException: Connection is read-only. Queries leading to data modification are not allowed

今天更新数据时出现这个错误:

java.sql.SQLException: Connection is read-only. Queries leading to data modification are not allowed

原因:我在service层设置了只读。@Transactional(readOnly = true)

而更新的方法没有把可读设置为FALSE。解决办法是在方法上加上readOnly=FALSE

注解如下:    @Transactional(readOnly = false, isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED)

 

5、Required request body is missing :public org.springframework.http.ResponseEntity ……

原因:没有传参

 

6、.m.m.a.ExceptionHandlerExceptionResolver : Resolved exception caused by Handler execution: org.springframework.web.method.annotation.MethodArgumentTypeMismatchException: Failed to convert value of type 'java.lang.String' to required type 'java.lang.Integer'; nested exception is java.lang.NumberFormatException: For input string: "undefined"

原因:调用的方法id对不上号,js错误

你是技术宅么?那就加入我们吧!点击下方链接 或 扫描二维码 即可。

欢迎加入 CSDN技术交流群2:(点击即可加群)QQ群:456543087

               CSDN技术交流群(已满员):(点击即可加群)QQ群:681223095。  

商务合作@群主,谢谢!

因经常有人留言,未能及时查看到和回复,所以特建此群,以方便交流。方便问题讨论,有问题和没有问题的小伙伴均可加入,用作自我学习和共同进步。本博主不一定长期在线,但是qq群里会有很多热心的小伙伴,大家一起讨论解决问题。

 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值