Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

高版本jdk报错 #2240

Closed
asd123wto opened this issue Dec 22, 2021 · 7 comments
Closed

高版本jdk报错 #2240

asd123wto opened this issue Dec 22, 2021 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@asd123wto
Copy link

建议先去看文档
快速开始常见问题
触发场景描述

3.0.5版本反射代理有问题
在jdk11上出现警告但还能用

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by net.sf.cglib.core.ReflectUtils$1 (file:/C:/Users/admin/.m2/repository/cglib/cglib/3.3.0/cglib-3.3.0.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of net.sf.cglib.core.ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

而在jdk17上直接报错无法使用!!!!!!!!!!!!!!!!!!!!

触发Bug的代码

 @GetMapping("download")
    public void download(HttpServletResponse response) throws IOException {
        // 这里注意 有同学反应使用swagger 会导致各种问题,请直接用浏览器或者用postman
        response.setContentType("application/vnd.ms-excel");
        response.setCharacterEncoding("utf-8");
        // 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系
        String fileName = URLEncoder.encode("测试", "UTF-8");
        response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
        EasyExcel.write(response.getOutputStream(), DownloadData.class).sheet("模板").doWrite(data());
    }

 报错定位: doWrite(data());

提示的异常或者没有达到的效果

com.alibaba.excel.exception.ExcelGenerateException: java.lang.ExceptionInInitializerError
Caused by: java.lang.ExceptionInInitializerError
Caused by: net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InaccessibleObjectException-->Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @175c2241
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @175c2241

@asd123wto asd123wto added the bug Something isn't working label Dec 22, 2021
@chakery
Copy link

chakery commented Dec 30, 2021

我也遇到了同样的问题

@jack6265
Copy link

jack6265 commented Jan 7, 2022

升级jdk17之后,我也遇到了同样的问题,望尽快解决,谢谢

@wangkang09
Copy link

好像是高版本 JDK 把之前的告警行为改成了报错。需要加上 java -jar --add-opens java.base/java.lang=ALL-UNNAMED
image

@zsm5833
Copy link

zsm5833 commented Jan 30, 2022

#2040

@jimrueaster
Copy link

我也遇到了同样的问题

@zhuangjiaju
Copy link
Collaborator

在3.1.0 里面会修复

@GongHang1
Copy link

3.1.0预计什么时候发布

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

8 participants