异常(那些年我们遇到的一些坑)

 (1)bug  "Session校验拦截,系统异常,请联系管理员!",

          对策:需要把SessionController改成RestController

(2)项目可以正常启动,但是bug模式启动不了

    对策:清空所有断点

(3)Cause by: java.lang.IllegalArgumentException: Can not set com.alibaba.fastjson.JSONObject field com.ztesoft.zsmart.nros.sbc.item.server.domain.EntityBase.creator to java.util.HashMap

因为入参有误

(4)Caused by: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `java.lang.String` out of START_OBJECT token
at [Source: (PushbackInputStream); line: 10, column: 15] (through reference chain: com.ztesoft.zsmart.nros.sbc.admin.item.model.dto.BrandDTO["creator"])

因为BrandDTO中的creator格式是String不是json所以说不能序列化

(5)

Cause by: org.hibernate.PropertyAccessException: Could not set field value [{}] value by reflection : [class com.ztesoft.zsmart.nros.sbc.item.server.domain.AppraisalE.creator] setter of com.ztesoft.zsmart.nros.sbc.item.server.domain.AppraisalE.creator
传入参数有误
返回406,然后前端报系统异常之类的一般是数据库中数据有些是空,查询的刚好是这条数据,所以出现问题。因为orElse(other:null)是这样

(6)

Caused by: org.postgresql.util.PSQLException: ERROR: operator does not exist: character varying = integer

其中 operator 是操作符的意思,​而不是操作人。

发生此错误是因为 把字符类型的列 和 数字做比较了,postgresql不支持​这样的操作,和mysql不一样。

比如 bill_no 是varchar类型的,  但是sql 语句的查询条件写成, bill_no = 123456, 就出错,须改成  bill_no = '123456'​

(7)Cause by: java.lang.IllegalArgumentException: Can not set com.alibaba.fastjson.JSONObject field com.....EntityBase.creator to java.util.HashMap,也可能与(5)共存
数据库中是json格式,java里面也是json格式,出现这种错误是因为数据库中是null,而不是{}

(8)在调用feign时候报空指针异常(一般是路径有误,没找到相关的代码)

(9)java.lang.IllegalStateException: No primary or default constructor found for interface java.util.List

at 因为缺少@RequestBody

org.springframework.http.converter.HttpMessageNotReadableException: Required request body is missing: public com.ztesoft.zsmart.nros.base.model.ResponseMsg<java.util.List<com.ztesoft.zsmart.nros.sbc.item.client.model.StorePrivilege>> com.ztesoft.zsmart.nros.sbc.item.controller.ItemController.saveStorePrivilegeList(java.util.List<com.ztesoft.zsmart.nros.sbc.item.client.model.StorePrivilege>)
at 

应该调用该方法CommonFunctions.runSupplierByList(,而不是
CommonFunctions.runSupplier
(10)当遇到一个代码a可以执行成功,另外一堆代码(b,c,d,e)不能执行成功,可以考虑是不是惹的祸(a-e均代表执行模块)
(11)return outside method因为方法没加括号
(12)

Caused by: javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.MappingException: Could not determine type for: com.ztesoft.zsmart.nros.sbc.item.server.common.cms.producer.PushProducer, at table: ic_item, for columns: [org.hibernate.mapping.Column(push_producer)]需要添加

@Transient

 

转载于:https://www.cnblogs.com/wth21-1314/p/11077861.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值