[alibaba/easyexcel]easyExcel报ExcelGenerateException异常

2024-05-30 142 views
3

异常代码

 OutputStream ops = response.getOutputStream();
 ExcelWriter  excelWriter = EasyExcel.write(ops).build();
 List<String> headers = this.regRecordAdminService.getExcelHeaders(queryRegRecordDTO.getActId());
 List<List<String>> excelHeader = new ArrayList<>();
 excelHeader.add(headers);
 int i=0;
 for(RegRecordReviewStatusEnum regRecordReviewStatusEnum : RegRecordReviewStatusEnum.values()){
                WriteSheet sheet = EasyExcel.writerSheet(i++,regRecordReviewStatusEnum.getName()).head(excelHeader).build();
                queryRegRecordDTO.setReviewStatusEnum(regRecordReviewStatusEnum);
                List<RegRecord> list = this.regRecordAdminService.listRegRecord(queryRegRecordDTO);
                List<List<Object>> excelData = this.regRecordAdminService.excelData(list);
                excelWriter.write(excelData, sheet);//这行报“can not close IO”
            }

异常提示 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.ExcelWriter.finish(ExcelWriter.java:298) at com.southcn.nfapp.aurora.admin.controller.RegRecordController.exportRegRecord(RegRecordController.java:86) 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 org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:105) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:889) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:794) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1039) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:897) at javax.servlet.http.HttpServlet.service(HttpServlet.java:634) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882) at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:92) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMetrics(WebMvcMetricsFilter.java:118) at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:107) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) 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:200) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:836) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1747) 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)

建议描述

回答

2

贴全异常

9

2019-10-17 18:11:51,168 [http-nio-8080-exec-1] ERROR c.s.nfapp.aurora.admin.aop.GlobalExceptionHandler (GlobalExceptionHandler.java:65) - Can not close IO 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.ExcelWriter.finish(ExcelWriter.java:298)  at com.southcn.nfapp.aurora.admin.controller.RegRecordController.exportRegRecord(RegRecordController.java:90)  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 org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190)  at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138)  at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:105)  at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:889)  at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:794)  at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)  at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1039)  at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942)  at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005)  at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:897)  at javax.servlet.http.HttpServlet.service(HttpServlet.java:634)  at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882)  at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)  at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)  at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)  at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)  at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:92)  at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)  at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93)  at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)  at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMetrics(WebMvcMetricsFilter.java:118)  at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:107)  at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)  at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)  at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)  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:200)  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)  at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490)  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)  at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408)  at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)  at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:836)  at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1747)  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.NoSuchMethodError: org.apache.poi.util.IOUtils.copy(Ljava/io/InputStream;Ljava/io/OutputStream;)V  at org.apache.poi.xssf.streaming.SXSSFWorkbook.injectData(SXSSFWorkbook.java:396)  at org.apache.poi.xssf.streaming.SXSSFWorkbook.write(SXSSFWorkbook.java:936)  at com.alibaba.excel.context.WriteContextImpl.finish(WriteContextImpl.java:349)  ... 62 common frames omitted 2019-10-17 18:11:51,171 [http-nio-8080-exec-1] DEBUG o.s.w.s.m.m.a.RequestResponseBodyMethodProcessor (AbstractMessageConverterMethodProcessor.java:223) - Found 'Content-Type:application/vnd.ms-excel;charset=utf-8' in response 2019-10-17 18:11:51,172 [http-nio-8080-exec-1] WARN  o.s.w.s.m.m.a.ExceptionHandlerExceptionResolver (ExceptionHandlerExceptionResolver.java:416) - Failure in @ExceptionHandler com.southcn.nfapp.aurora.admin.aop.GlobalExceptionHandler#runtimeException(RuntimeException) org.springframework.web.HttpMediaTypeNotAcceptableException: Could not find acceptable representation  at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor.writeWithMessageConverters(AbstractMessageConverterMethodProcessor.java:307)  at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.handleReturnValue(RequestResponseBodyMethodProcessor.java:180)  at org.springframework.web.method.support.HandlerMethodReturnValueHandlerComposite.handleReturnValue(HandlerMethodReturnValueHandlerComposite.java:82)  at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:123)  at org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver.doResolveHandlerMethodException(ExceptionHandlerExceptionResolver.java:405)  at org.springframework.web.servlet.handler.AbstractHandlerMethodExceptionResolver.doResolveException(AbstractHandlerMethodExceptionResolver.java:61)  at org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver.resolveException(AbstractHandlerExceptionResolver.java:140)  at org.springframework.web.servlet.handler.HandlerExceptionResolverComposite.resolveException(HandlerExceptionResolverComposite.java:79)  at org.springframework.web.servlet.DispatcherServlet.processHandlerException(DispatcherServlet.java:1298)  at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1110)  at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1056)  at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942)  at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005)  at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:897)  at javax.servlet.http.HttpServlet.service(HttpServlet.java:634)  at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882)  at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)  at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)  at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)  at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)  at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:92)  at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)  at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93)  at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)  at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMetrics(WebMvcMetricsFilter.java:118)  at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:107)  at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)  at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)  at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)  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:200)  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)  at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490)  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)  at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408)  at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)  at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:836)  at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1747)  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) 2019-10-17 18:11:51,177 [http-nio-8080-exec-1] DEBUG org.springframework.web.servlet.DispatcherServlet (FrameworkServlet.java:1100) - Failed to complete request: com.alibaba.excel.exception.ExcelGenerateException: Can not close IO 2019-10-17 18:11:51,179 [http-nio-8080-exec-1] ERROR o.a.c.c.C.[.[.[.[dispatcherServlet] (DirectJDKLog.java:175) - Servlet.service() for servlet [dispatcherServlet] in context with path [/nfplus-aurora-admin] threw exception [Request processing failed; nested exception is com.alibaba.excel.exception.ExcelGenerateException: Can not close IO] with root cause java.lang.NoSuchMethodError: org.apache.poi.util.IOUtils.copy(Ljava/io/InputStream;Ljava/io/OutputStream;)V  at org.apache.poi.xssf.streaming.SXSSFWorkbook.injectData(SXSSFWorkbook.java:396)  at org.apache.poi.xssf.streaming.SXSSFWorkbook.write(SXSSFWorkbook.java:936)  at com.alibaba.excel.context.WriteContextImpl.finish(WriteContextImpl.java:349)  at com.alibaba.excel.write.ExcelBuilderImpl.finish(ExcelBuilderImpl.java:106)  at com.alibaba.excel.ExcelWriter.finish(ExcelWriter.java:298)  at com.southcn.nfapp.aurora.admin.controller.RegRecordController.exportRegRecord(RegRecordController.java:90)  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 org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190)  at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138)  at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:105)  at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:889)  at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:794)  at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)  at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1039)  at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942)  at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005)  at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:897)  at javax.servlet.http.HttpServlet.service(HttpServlet.java:634)  at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882)  at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)  at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)  at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)  at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)  at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:92)  at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)  at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93)  at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)  at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMetrics(WebMvcMetricsFilter.java:118)  at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:107)  at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)  at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)  at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)  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:200)  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)  at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490)  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)  at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408)  at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)  at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:836)  at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1747)  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) 2019-10-17 18:11:51,182 [http-nio-8080-exec-1] DEBUG org.springframework.web.servlet.DispatcherServlet (LogFormatUtils.java:91) - "INCLUDE" dispatch for GET "/nfplus-aurora-admin/error", parameters={} 2019-10-17 18:11:51,183 [http-nio-8080-exec-1] DEBUG s.d.s.w.PropertySourcedRequestMappingHandlerMapping (PropertySourcedRequestMappingHandlerMapping.java:108) - looking up handler for path: /error 2019-10-17 18:11:51,185 [http-nio-8080-exec-1] DEBUG o.s.w.s.m.m.a.RequestMappingHandlerMapping (AbstractHandlerMapping.java:411) - Mapped to org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController#error(HttpServletRequest) 2019-10-17 18:11:51,186 [http-nio-8080-exec-1] DEBUG o.s.w.s.m.m.annotation.HttpEntityMethodProcessor (AbstractMessageConverterMethodProcessor.java:223) - Found 'Content-Type:application/vnd.ms-excel;charset=utf-8' in response 2019-10-17 18:11:51,186 [http-nio-8080-exec-1] DEBUG o.s.w.s.m.m.a.ExceptionHandlerExceptionResolver (ExceptionHandlerExceptionResolver.java:400) - Using @ExceptionHandler com.southcn.nfapp.aurora.admin.aop.GlobalExceptionHandler#exception(Exception) 2019-10-17 18:11:51,187 [http-nio-8080-exec-1] ERROR c.s.nfapp.aurora.admin.aop.GlobalExceptionHandler (GlobalExceptionHandler.java:71) - Could not find acceptable representation org.springframework.web.HttpMediaTypeNotAcceptableException: Could not find acceptable representation  at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor.writeWithMessageConverters(AbstractMessageConverterMethodProcessor.java:307)  at org.springframework.web.servlet.mvc.method.annotation.HttpEntityMethodProcessor.handleReturnValue(HttpEntityMethodProcessor.java:225)  at org.springframework.web.method.support.HandlerMethodReturnValueHandlerComposite.handleReturnValue(HandlerMethodReturnValueHandlerComposite.java:82)  at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:123)  at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:889)  at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:794)  at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)  at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1039)  at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942)  at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005)  at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:897)  at javax.servlet.http.HttpServlet.service(HttpServlet.java:634)  at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882)  at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)  at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:712)  at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:580)  at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:516)  at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:388)  at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:253)  at org.apache.catalina.core.StandardHostValve.throwable(StandardHostValve.java:348)  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:173)  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)  at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408)  at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)  at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:836)  at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1747)  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) 2019-10-17 18:11:51,188 [http-nio-8080-exec-1] DEBUG o.s.w.s.m.m.a.RequestResponseBodyMethodProcessor (AbstractMessageConverterMethodProcessor.java:223) - Found 'Content-Type:application/vnd.ms-excel;charset=utf-8' in response 2019-10-17 18:11:51,188 [http-nio-8080-exec-1] WARN  o.s.w.s.m.m.a.ExceptionHandlerExceptionResolver (ExceptionHandlerExceptionResolver.java:416) - Failure in @ExceptionHandler com.southcn.nfapp.aurora.admin.aop.GlobalExceptionHandler#exception(Exception) org.springframework.web.HttpMediaTypeNotAcceptableException: Could not find acceptable representation  at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor.writeWithMessageConverters(AbstractMessageConverterMethodProcessor.java:307)  at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.handleReturnValue(RequestResponseBodyMethodProcessor.java:180)  at org.springframework.web.method.support.HandlerMethodReturnValueHandlerComposite.handleReturnValue(HandlerMethodReturnValueHandlerComposite.java:82)  at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:123)  at org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver.doResolveHandlerMethodException(ExceptionHandlerExceptionResolver.java:409)  at org.springframework.web.servlet.handler.AbstractHandlerMethodExceptionResolver.doResolveException(AbstractHandlerMethodExceptionResolver.java:61)  at org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver.resolveException(AbstractHandlerExceptionResolver.java:140)  at org.springframework.web.servlet.handler.HandlerExceptionResolverComposite.resolveException(HandlerExceptionResolverComposite.java:79)  at org.springframework.web.servlet.DispatcherServlet.processHandlerException(DispatcherServlet.java:1298)  at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1110)  at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1056)  at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942)  at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005)  at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:897)  at javax.servlet.http.HttpServlet.service(HttpServlet.java:634)  at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882)  at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)  at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:712)  at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:580)  at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:516)  at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:388)  at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:253)  at org.apache.catalina.core.StandardHostValve.throwable(StandardHostValve.java:348)  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:173)  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)  at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408)  at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)  at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:836)  at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1747)  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)

6

这是接口代码 @ApiOperation("导出报表") @GetMapping("exportRegRecord") @NoLogin public void exportRegRecord(@RequestBody QueryRegRecordDTO queryRegRecordDTO, HttpServletResponse response) throws IOException { Assert.hasLength(queryRegRecordDTO.getActId(),"actId不能空"); Activity activity = activityAdminService.getActivityById(queryRegRecordDTO.getActId()); Assert.notNull(activity,"活动不存在"); ExcelWriter excelWriter = null; OutputStream ops = null; response.setContentType("application/vnd.ms-excel"); response.setCharacterEncoding("utf-8"); String fileName = URLEncoder.encode(activity.getTitle() + "活动报名数据", "UTF-8"); response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); try{ ops = response.getOutputStream(); excelWriter = EasyExcel.write(ops).build(); List<String> headers = this.regRecordAdminService.getExcelHeaders(queryRegRecordDTO.getActId()); List<List<String>> excelHeader = new ArrayList<>(); excelHeader.add(headers); int i=0; for(RegRecordReviewStatusEnum regRecordReviewStatusEnum : RegRecordReviewStatusEnum.values()){ WriteSheet sheet = EasyExcel.writerSheet(i++,regRecordReviewStatusEnum.getName()).head(excelHeader).build(); queryRegRecordDTO.setReviewStatusEnum(regRecordReviewStatusEnum); List<RegRecord> list = this.regRecordAdminService.listRegRecord(queryRegRecordDTO); List<List<Object>> excelData = this.regRecordAdminService.excelData(list); excelWriter.write(excelData, sheet); } }catch (Exception e){ throw new SouthcnException(MsgCode.FAIL, "导出报表出错:" + e.getMessage() + "\n cause by:" + e.getCause()); }finally { if(Objects.nonNull(excelWriter)){ excelWriter.finish(); } if(Objects.nonNull(ops)){ ops.close(); } } }

2

NoSuchMethodError: org.apache.poi.util.IOUtils.copy(Ljava/io/InputStream;Ljava/io/OutputStream;)V 请检查 poi 版本是否统一 3.17 或者 4.0,1

6

poi是4.0.1 easyexcel是2.0.5