栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

bug记录

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

bug记录

 此段代码导出excel功能在swagger里调试可以下载正常打开excel,从前台页面调用接口时确无法打开文件报错信息如下,打开之后也是一堆乱码

 一开始以为时用流传输,转化的流出现了问题,可是swagg能打开说明流没有问题,于是猜测是和前台进行交互的过程中出现问题,仔细排查后发现前端传参用的是Post而后端用的是Get,统一Get传参后问题解决

———————————————————————————————————————————

在编写过程中经常遇到的报错:

NullPointerException: null     空指针

ERROR o.a.c.c.C.[.[localhost].[/].[dispatcherServlet] - Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.NullPointerException] with root cause
java.lang.NullPointerException: null

总结了一下这个报错我遇到的原因有以下几点:

1、字符串变量未初始化

2、接口类型的对象没有用具体的类初始化

3、当一个对象的值为空时,没有判空

Unparseable date: "XXXX"

 ERROR o.a.c.c.C.[.[localhost].[/].[dispatcherServlet] - Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.text.ParseException: Unparseable date: "202004"] with root cause
java.text.ParseException: Unparseable date: "202004"

原因:数据库存储的字段数据类型与传过来的数据类型不一样

Parameter 'XXXX' not found. Available parameters are [XXX, param1]

ERROR o.a.c.c.C.[.[localhost].[/].[dispatcherServlet] - Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter 'job_id' not found. Available parameters are [userinformation, param1]] with root cause
org.apache.ibatis.binding.BindingException: Parameter 'job_id' not found. Available parameters are [userinformation, param1]

参数传递错误,出现的原因:接口方法没用@Param注解

For input string: "XXX"

ERROR o.a.c.c.C.[.[localhost].[/].[dispatcherServlet] - Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.NumberFormatException: For input string: "string"] with root cause
java.lang.NumberFormatException: For input string: "string"

参数类型转换时报错:把不符合数字格式的字符串转换为数字时抛出的格式化异常;

Expected one result (or null) to be returned by selectOne(), but found: XX

ERROR o.a.c.c.C.[.[localhost].[/].[dispatcherServlet] - Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.TooManyResultsException: Expected one result (or null) to be returned by selectOne(), but found: 12] with root cause
org.apache.ibatis.exceptions.TooManyResultsException: Expected one result (or null) to be returned by selectOne(), but found: 12

实际的返回数据条数超出设定的返回条数

Invalid bound statement (not found)

ERROR o.a.c.c.C.[.[localhost].[/].[dispatcherServlet] - Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.httech.hrms.mapper.cdp.PromotionInfoMapper.getAllInformationWithErr] with root cause
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.httech.hrms.mapper.cdp.PromotionInfoMapper.getAllInformationWithErr

原因:xml里面的namespace不对 或者id和mapper里面的方法名不一样,或者parameterType对应不上

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/490499.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号