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


     (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
  • 相关阅读:
    设计模式中的多态——策略模式详解
    Spring IOC容器启动流程源码解析(一)——容器概念详解及源码初探
    并发包下常见的同步工具类详解(CountDownLatch,CyclicBarrier,Semaphore)
    HNOI2020游记
    旧年之末,新年伊始
    退役V次后做题记录
    PKUWC2020 游记
    CSP2019退役记
    CTS/APIO2019游记
    HNOI2019游记
  • 原文地址:https://www.cnblogs.com/wth21-1314/p/11077861.html
Copyright © 2020-2023  润新知