使用MyBatis-Plus分页查询组件时遇到的No core dump will be written异常解决办法

解决办法:

将各组件版本调整为如下所示:
Spring Cloud:Hoxton.SR5
Spring Boot:2.2.12.RELEASE
spring-cloud-alibaba-dependencies:2.2.1.RELEASE
aliyun-oss-spring-boot-starter:1.1.0
MyBatis Plus:3.4.1
JDK:11.0.9
Nacos:1.4.0

不当的组件版本组合为:
Spring Cloud:Hoxton.SR8
Spring Boot:2.3.7.RELEASE
spring-cloud-alibaba-dependencies:2.2.1.RELEASE
aliyun-oss-spring-boot-starter:1.1.0
MyBatis Plus:3.3.1
JDK:11.0.9
Nacos:1.4.0

MBP的分页组件主要代码如下:

@Bean
public PaginationInterceptor paginationInterceptor() {
    
    
    PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
    // 设置请求的页面大于最大页后操作,true为调回到首页,false为继续请求。默认为false。
    // paginationInterceptor.setOverflow(false);
    paginationInterceptor.setOverflow(true);
    // 设置最大单页限制数量,默认 500 条,-1 不受限制
    // paginationInterceptor.setLimit(500);
    paginationInterceptor.setLimit(1000);
    // 开启count的join优化,只针对部分left join(本文问题原因所在!):
    paginationInterceptor.setCountSqlParser(new JsqlParserCountOptimize(true));
    return paginationInterceptor;
}

在版本搭配不当而发送查询请求时,后端控制台异常如下:

2021-01-30 02:01:43.885 DEBUG 51272 --- [io-11000-exec-1] c.e.b.xx.dao.xxx.selectPage    : ==>  Preparing: SELECT COUNT(1) FROM test
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ffdfa599b1f, pid=51272, tid=52324
#
# JRE version: Java(TM) SE Runtime Environment 18.9 (11.0.9+7) (build 11.0.9+7-LTS)
# Java VM: Java HotSpot(TM) 64-Bit Server VM 18.9 (11.0.9+7-LTS, mixed mode, tiered, compressed oops, g1 gc, windows-amd64)
# Problematic frame:
# V  [jvm.dll+0x1f9b1f]
#
# No core dump will be written. Minidumps are not enabled by default on client versions of Windows
#
# An error report file with more information is saved as:
# D:\***\hs_err_pid51272.log
#
# If you would like to submit a bug report, please visit:
#   https://bugreport.java.com/bugreport/crash.jsp
#

有大神曾经讲过,版本搭配错误,可能会产生一些莫名其妙的异常,这次真的领教了!
查了好久都没发现问题的线索,有一次在查看Project Structure时,偶然看到了MyBatis-Plus的版本信息,和我记忆中其它服务的版本不一致。经过对比,才最终发现了差别。

猜你喜欢

转载自blog.csdn.net/shinyolive/article/details/113410047