[alibaba/easyexcel]这个错误怎么解决呢?com.alibaba.excel.exception.ExcelAnalysisException: java.lang.NoClassDefFoundError: org/ehcache/config/ResourceUnit

2024-05-23 404 views
2

在使用的时候后台报错。这个怎么解决呢。。错误如下 com.alibaba.excel.exception.ExcelAnalysisException: java.lang.NoClassDefFoundError: org/ehcache/config/ResourceUnit at com.alibaba.excel.analysis.ExcelAnalyserImpl.(ExcelAnalyserImpl.java:51) at com.alibaba.excel.ExcelReader.(ExcelReader.java:143) at com.alibaba.excel.read.builder.ExcelReaderBuilder.build(ExcelReaderBuilder.java:270) at com.jyd.serviceModule.taskinfo.controller.TaskInfoController.uploadExcelNew(TaskInfoController.java:294) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.jfinal.aop.Invocation.invoke(Invocation.java:75) at com.jfinal.ext.interceptor.SessionInViewInterceptor.intercept(SessionInViewInterceptor.java:44) at com.jfinal.aop.Invocation.invoke(Invocation.java:69) at com.jyd.interceptors.LoginInterceptor.intercept(LoginInterceptor.java:63) at com.jfinal.aop.Invocation.invoke(Invocation.java:69) at com.jfinal.core.ActionHandler.handle(ActionHandler.java:81) at com.jfinal.core.JFinalFilter.doFilter(JFinalFilter.java:89) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:660) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:798) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:808) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.NoClassDefFoundError: org/ehcache/config/ResourceUnit at com.alibaba.excel.cache.selector.SimpleReadCacheSelector.readCache(SimpleReadCacheSelector.java:80) at com.alibaba.excel.analysis.v07.XlsxSaxAnalyser.defaultReadCache(XlsxSaxAnalyser.java:93) at com.alibaba.excel.analysis.v07.XlsxSaxAnalyser.(XlsxSaxAnalyser.java:67) at com.alibaba.excel.analysis.ExcelAnalyserImpl.choiceExcelExecutor(ExcelAnalyserImpl.java:92) at com.alibaba.excel.analysis.ExcelAnalyserImpl.(ExcelAnalyserImpl.java:45) ... 33 more Caused by: java.lang.ClassNotFoundException: org.ehcache.config.ResourceUnit at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1364) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1185) ... 38 more

回答

1

检查你有没有引入这个包吧 ehcache

5

检查你有没有引入这个包吧 ehcache

引入了

2

确认下ehcach版本兼容。

2

我也出这个问题了,问下大佬们怎么解决的。。

3

easyexcel所使用的ehcache的版本必须对应当前你环境的版本。最新的easyexcel是ehcache-3.4.0.jar

0

项目原先并没有引入ehcache,使用3.0.5版本easyexcel后产生这个ehcache的报错,可以把ehcache依赖排除掉吗?