【EasyExcel】使用easyExcel過程當中,項目報錯的解決集合

 

報錯:Can not close IOhtml

[ERROR] 2019-11-02 13:51:21.210 [ProExportSkuDataJob-1455-TaskThread-1] [com.dmall.proengine.domain.common.util.DpeLogUtil] [] - fd3f7b29-20191102134946773,dpePartner#ProExportSkuDataJob   Job execute fail,errMsg= com.alibaba.excel.exception.ExcelGenerateException: Can not close IO
    at com.alibaba.excel.context.WriteContextImpl.throwCanNotCloseIo(WriteContextImpl.java:390)
    at com.alibaba.excel.context.WriteContextImpl.finish(WriteContextImpl.java:352)
    at com.alibaba.excel.write.ExcelBuilderImpl.finish(ExcelBuilderImpl.java:106)
    at com.alibaba.excel.write.ExcelBuilderImpl.addContent(ExcelBuilderImpl.java:98)
    at com.alibaba.excel.ExcelWriter.write(ExcelWriter.java:155)
    at com.alibaba.excel.ExcelWriter.write(ExcelWriter.java:140)
    at com.alibaba.excel.write.builder.ExcelWriterSheetBuilder.doWrite(ExcelWriterSheetBuilder.java:134)
    at com.dmall.proengine.partner.export.job.ProExportSkuDataJob.createXlsxFile2(ProExportSkuDataJob.java:178)
    at com.dmall.proengine.partner.export.job.ProExportSkuDataJob.executeTask(ProExportSkuDataJob.java:83)
    at com.dmall.dispatcher.sdk.task.AbstractSimpleTask.execute(AbstractSimpleTask.java:56)
    at com.dmall.dispatcher.sdk.thread.TaskExecuteThread.run(TaskExecuteThread.java:59)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NoSuchMethodError: org.apache.poi.ss.usermodel.Workbook.close()V
    at com.alibaba.excel.context.WriteContextImpl.finish(WriteContextImpl.java:350)
    ... 12 more

 

 

解決方法:java

將項目中pom.xml中依賴的  POI相關的版本升級到  3.17以上  【easyexcel版本  2.0.5】

我本身將POI版本升級到了4.1.0web

 

 

 

 

 

 

報錯:apache

java.lang.IncompatibleClassChangeError: class net.sf.cglib.core.DebuggingClassWriter has interface org.objectweb.asm.ClassVisitor as super classapp

dom

Could not initialize class net.sf.cglib.beans.BeanMap$Generatorui

 

com.alibaba.excel.exception.ExcelGenerateException: java.lang.IncompatibleClassChangeError: class net.sf.cglib.core.DebuggingClassWriter has interface org.objectweb.asm.ClassVisitor as super class
    at com.alibaba.excel.write.ExcelBuilderImpl.addContent(ExcelBuilderImpl.java:99)
    at com.alibaba.excel.ExcelWriter.write(ExcelWriter.java:155)
    at com.alibaba.excel.ExcelWriter.write(ExcelWriter.java:140)
    at com.dmall.proengine.partner.export.job.ProExportSkuDataJob.createXlsxFile2(ProExportSkuDataJob.java:182)
    at com.dmall.proengine.partner.export.job.ProExportSkuDataJob.executeTask(ProExportSkuDataJob.java:83)
    at com.dmall.dispatcher.sdk.task.AbstractSimpleTask.execute(AbstractSimpleTask.java:56)
    at com.dmall.dispatcher.sdk.thread.TaskExecuteThread.run(TaskExecuteThread.java:59)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IncompatibleClassChangeError: class net.sf.cglib.core.DebuggingClassWriter has interface org.objectweb.asm.ClassVisitor as super class
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:2567)
    at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:859)
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1302)
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1167)
    at net.sf.cglib.core.DefaultGeneratorStrategy.getClassVisitor(DefaultGeneratorStrategy.java:30)
    at net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:24)
    at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:216)
    at net.sf.cglib.core.KeyFactory$Generator.create(KeyFactory.java:144)
    at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:116)
    at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:108)
    at net.sf.cglib.beans.BeanMap$Generator.<clinit>(BeanMap.java:64)
    at net.sf.cglib.beans.BeanMap.create(BeanMap.java:56)
    at com.alibaba.excel.write.ExcelBuilderImpl.addJavaObjectToExcel(ExcelBuilderImpl.java:201)
    at com.alibaba.excel.write.ExcelBuilderImpl.addOneRowOfDataToExcel(ExcelBuilderImpl.java:128)
    at com.alibaba.excel.write.ExcelBuilderImpl.doAddContent(ExcelBuilderImpl.java:79)
    at com.alibaba.excel.write.ExcelBuilderImpl.addContent(ExcelBuilderImpl.java:93)
    ... 9 more

 

 

解決方法:spa

是由於項目中有cglib的jar包  和 asm的jar包衝突。解決掉jar包衝突便可。excel

 

解決jar包衝突的方法:code

http://www.javashuo.com/article/p-owiigtkq-kg.html

相關文章
相關標籤/搜索