[alibaba/easyexcel]EasyExcel.write(outputStream,OrderRespExcel.class).sheet().doWrite(orderRespExcels); 抛异常

2024-05-11 301 views
4

使用方式: ServletOutputStream outputStream = response.getOutputStream(); EasyExcel.write(outputStream,OrderRespExcel.class).sheet().doWrite(orderRespExcels);

BeanMap create(Object bean) { Generator gen = new Generator(); debug源码到这儿抛异常 异常信息: com.alibaba.excel.exception.ExcelGenerateException: java.lang.ExceptionInInitializerError at com.alibaba.excel.write.ExcelBuilderImpl.addContent(ExcelBuilderImpl.java:65) ~[easyexcel-3.0.5.jar:?] at com.alibaba.excel.ExcelWriter.write(ExcelWriter.java:73) ~[easyexcel-3.0.5.jar:?] at com.alibaba.excel.ExcelWriter.write(ExcelWriter.java:50) ~[easyexcel-3.0.5.jar:?]

Caused by: java.lang.ExceptionInInitializerError at com.alibaba.excel.util.BeanMapUtils.create(BeanMapUtils.java:26) ~[easyexcel-3.0.5.jar:?] at com.alibaba.excel.write.executor.ExcelWriteAddExecutor.addJavaObjectToExcel(ExcelWriteAddExecutor.java:144)

回答

4

换个jdk版本试试看,我一开始用jdk16,也是报了这个错误,后来改成jdk11就没有了

1

好的谢谢,因为时间问题已经换成hutool的excel了,我自己的demo没这个问题

6

这个会在 3.1.0 版本中解决