![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
bug记录
平时出现的bug记录一下
玉爷~
技术学的好,讨饭讨到老。
展开
-
使用yum报错:Errors during downloading metadata for repository ‘appstream‘
问题:使用yum报错Errors during downloading metadata for repository 'appstream': - Status code: 404 for http://mirrors.cloud.aliyuncs.com/centos/8/AppStream/x86_64/os/repodata/repomd.xml (IP: 100.100.2.148)Error: Failed to download metadata for repo 'appstream原创 2022-02-11 10:43:47 · 1845 阅读 · 0 评论 -
URLConnectio发送中文乱码
原代码:DataOutputStream os=new DataOutputStream(conn.getOutputStream());os.writeBytes(objJson);改后代码:DataOutputStream os=new DataOutputStream(conn.getOutputStream());os.write(objJson.getBytes("utf-8"));原创 2021-10-20 11:41:35 · 75 阅读 · 0 评论 -
启动web项目,静态变量值为null
大致代码如下private static String url = "http://xxx.com"; private static String key = "xxxxxxxxxxxx"; static{ try { //读取properties文件的属性,文件不存在 url = "xx"; key = "xxxx"; } catch (){ } }使用单元测试,可以取到url和key。但是web项目(spring…)中启动,url就是null,key可以取到原创 2021-10-13 19:00:21 · 193 阅读 · 0 评论 -
启动项目报错:java.lang.OutOfMemoryError: PermGen space
加大内存设置:-Xms1024M -Xmx2048M -XX:PermSize=128M -XX:MaxPermSize=256M原创 2021-10-13 18:54:59 · 96 阅读 · 0 评论 -
由于公司一中一个老项目使用jdk1.7导致http访问报错
场景:使用httpclient调用供应商的接口,我自己电脑上运行没问题,提交代码后,同事拉取调用报错报错:javax.net.ssl.SSLException: Received fatal alert: protocol_version at sun.security.ssl.Alerts.getSSLException(Alerts.java:208) at sun.security.ssl.Alerts.getSSLException(Alerts.java:154) at sun.secu原创 2021-10-13 18:24:10 · 414 阅读 · 0 评论 -
POI报错:IllegalArgumentException: Your InputStream was neither an OLE2 stream, nor an OOXML stream
场景:使用springMVC和POI处理excel文件,使用springMVC的MultipartFile接受文件流,在使用creat的时候报错。InputStream inputStream = file.getInputStream();Workbook workbook = WorkbookFactory.create(inputStream);错误信息:java.lang.IllegalArgumentException: Your InputStream was neither an原创 2021-09-24 09:32:10 · 11325 阅读 · 0 评论 -
平时记录
一、已懂1、springboot项目,在resource中banner.txt文件,可以替换启动动画2、@Transactional(rollbackFor = Exception.class) rollbackFor = Exception.class作用:遇到非RuntimeException的异常时,也回滚,没有改属性则只回滚RuntimeException3、spring工具类:Assert 不符合条件,抛出IllegalArgumentException异常4、添加...原创 2020-12-05 13:36:03 · 178 阅读 · 0 评论 -
报错:1267 - Illegal mix of collations (utf8mb4_0900_ai_ci,IMPLICIT) and (utf8mb4_general_ci,IMPLICIT)
SELECT NULL as id, t.source_id, t.airline_name, t.flight_no, t.space_type, t.start_station, t.start_code, t.end_station, t.end_code, t.transfer_station, t.product_type, t.free_space, t.free_space, t.effect_date, NOW(), N.原创 2020-10-15 15:50:13 · 2655 阅读 · 0 评论 -
幂等性问题:用户多次点击导致重复扣款
业务场景:物流系统中,用户在后台点击发货(调整货物重量,重新计价),这时候会进行修改订单状态,并且扣款或退款。bug:但是这时候,用户同一时间点了多次发货,导致重复扣款。思考:首先,更新订单状态的时候加个条件判断,这样就不会重复更新订单了。update set order_status where order_status = 0其次,根据更新订单状态返回的结果来进行扣款退款操作。也就是说,更新条数为1,则执行退扣款操作,更新条数为0则不进行退扣款操作。最后,必须保证同一时间下,只原创 2020-09-23 18:37:26 · 490 阅读 · 2 评论 -
未使用@RequestBody,获取不到请求参数中的json数据
springmvc注解:@RequestParam可以取get请求url后的参数,也可以取post请求中表单的参数@ResponseBody是解析请求体中的json数据,转化为对象。因为使用了@RequestBody注解,最终使用到的参数处理器为RequestResponseBodyMethodProcessor,实际上会用到MappingJackson2HttpMessageConverter进行参数类型的转换,底层依赖到Jackson相关的包。controller 的区别在接收参数注解原创 2020-09-23 17:54:20 · 2547 阅读 · 0 评论 -
new创建对象,成员对象使用@Autowired注入为null
使用new创建的对象,该对象中@Autowired注入的成员对象为null。所以如果一个类中有spring容器注入的对象,则不能使用new来创建对象,必须使用必须@Autowired、@Resource来创建该对象。也就是说要把该对象也交给spring容器来管理。...原创 2020-09-23 17:43:02 · 2508 阅读 · 0 评论 -
获取get请求的数组失败
前端把参数对象序列化后,手动添加到url后面,数组变成了orderStatusArray[0]=1&orderStatusArray[1]=2后端springmvc使用List<string> orderStatusArray 取不到值,为null。原因:springmvc认为这是两个参数名为“orderStatusArray[0]”和“orderStatusArray[1]”的参数,而不是一个数组。...原创 2020-09-23 17:28:24 · 207 阅读 · 0 评论 -
maven:install的时候报错
错误描述:在进行maven:install的时候,报错,错误信息:Error:(6,36) java: 程序包com.kytech56.resource.domain不存在原因:order-proxy模块依赖了resource模块,resource模块的pom.xml中加入了以下插件<plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-原创 2020-09-23 17:24:32 · 109 阅读 · 0 评论 -
spring容器,循环引用
启动项目,跑出异常:、BeanCurrentlyInCreationException这是由于循环引用造成的,bean A引用bean B,bean 引用bean A,这样就形成了一个闭环。代码如下:@Servicepublic class OrderHandoverService { @Lazy @Autowired private NewOrderService orderService; ....}@Servicepublic clas原创 2020-09-23 16:55:41 · 104 阅读 · 0 评论 -
多表查询,未指明字段属于哪一张表
报错信息:Column 'order_sn' in where clause is ambiguous原因:多表查询时,两张表都有order_sn字段,未指明字段属于哪一张表原创 2020-09-23 16:49:02 · 176 阅读 · 0 评论 -
localDate类型不能在mapper.xml中与String做比较
报错信息:###Error querying database. Cause: java.lang.IllegalArgumentException: invalid comparison: java.time.LocalDate and java.lang.String### Cause: java.lang.IllegalArgumentException: invalid comparison: java.time.LocalDate and java.lang.String代码片段:m原创 2020-09-23 16:47:06 · 621 阅读 · 0 评论 -
Junit中使用Spring data jpa的getOne懒加载报错
代码:@org.junit.Testpublic void getOndTest(){ Customer customer = customerDao.getOne(2l); System.out.println(customer);}报错:org.hibernate.LazyInitializationException: could not initiali...原创 2020-01-29 17:09:02 · 367 阅读 · 0 评论 -
修改私服上的jar——gradle缓存
放假了,记录一下快放假前遇到的问题。还记得那一天,阳光明媚,蓝天。。。嗯,调bug烦死了,鬼记得天气了。。。在公司包代码写好后美滋滋打包到maven私服,然后老大告诉我,要添加xxx,我TM,不早说。一想,得,也简单,几分钟的事情而已,开工。5分钟过去,代码改好了,删除私服上的jar,重新传上去。完美,没毛病。开始该引入该jar的代码,然后悲剧了,找不到jar中新添加的clas...原创 2020-01-29 17:06:53 · 283 阅读 · 0 评论 -
安装mongodb报错
.\mongod.exe --config "D:\Program Files\MongoDB\Server\3.4\mongo.conf" --install使用命令安装mongodb的时候报错:2020-01-09T10:50:01.415+0800 I CONTROL [main] ***** SERVER RESTARTED *****2020-01-09T10:50:0...原创 2020-01-09 11:07:16 · 482 阅读 · 0 评论 -
使用Spring data jpa的jpql进行更新的时候报错
代码:dao层:@Query("update Customer set custName = ?1 where custId = ?2")@Modifyingpublic void updateCustomer(String name, Long id);测试:@org.junit.Testpublic void test3(){ customerDao.upda...原创 2019-12-24 17:43:36 · 510 阅读 · 0 评论 -
使用jpa和hibernate写jpql占位符问题
代码://条件查询 @Test public void findConditionTest(){ EntityManager em = null; EntityTransaction tx = null; try { em = JPAUtil.getEntityManager(); ...原创 2019-12-24 11:57:31 · 898 阅读 · 0 评论 -
使用jpa和hibernate连接mysq8.0.18出现的问题
在使用jpa和hibernate的时候,使用xml配置连接数据库,测试连接的时候报错xml中关于mysql配置如下:<!-- 数据库驱动 --><property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver" /><!-- 数据库地址 --><prope...原创 2019-12-24 11:53:39 · 573 阅读 · 0 评论 -
Arrays.asList()得到的list使用remove,add等方法报错
错误:java.lang.UnsupportedOperationException出错代码块:public class ListTest { public static void main(String[] args) { String[] array = {"1","2","3","4","5"}; List<String> list = Arrays.a...原创 2019-04-20 00:00:28 · 2396 阅读 · 0 评论