Я пытаюсь использовать JXLS с моим пользовательским оценщиком для загрузок Excel, после этой официальной страницы.
Понятия не имею, почему он не предоставляет мне объект Трансформер. Долгое время пытался разобраться с исключениями, но не смог их разрешить.
Excel
Maven
<dependency>
<groupId>org.jxls</groupId>
<artifactId>jxls</artifactId>
<version>2.4.3</version>
</dependency>
<dependency>
<groupId>org.jxls</groupId>
<artifactId>jxls-poi</artifactId>
<version>1.0.14</version>
</dependency>
Java :
InputStream is2 = new FileInputStream("C:/Users/User/Downloads/ExcelTest.xlsx");
OutputStream os = new FileOutputStream("C:/Users/User/Downloads/ExcelTest_Out.xlsx");
Transformer transformer = TransformerFactory.createTransformer(is2, os); // this throws error and returns null object
ExpressionEvaluator evaluator = new IMCScriptEvaluator(ctx);
transformer.getTransformationConfig().setExpressionEvaluator(evaluator);
Исключительная трассировка :
11: 23: 15.496 [tomcat-http - 35] ОШИБКА org.jxls.util.TransformerFactory
- Метод createTransformer класса org.jxls.transform.poi.PoiTransformer вызвал исключение java.lang.reflect.InvocationTargetException:
null at sun.reflect.NativeMethodAccessorImpl.invoke0 (собственный метод)
~ [na: 1.8.0_144] в
sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
~ [na: 1.8.0_144] в
sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
~ [na: 1.8.0_144] на java.lang.reflect.Method.invoke (Method.java:498)
~ [na: 1.8.0_144] в
org.jxls.util.TransformerFactory.createTransformer (TransformerFactory.java:35)
~ [jxls-2.4.3.jar: na] в
com.imc.iss.web.report.impl.JXLSFiller.generateWorkbook (JXLSFiller.java:411)
[core-0.0.2-SNAPSHOT.jar: 0.0.2-SNAPSHOT] в
, , ,
[core-0.0.2-SNAPSHOT.jar: 0.0.2-SNAPSHOT] в
sun.reflect.NativeMethodAccessorImpl.invoke0 (собственный метод)
~ [na: 1.8.0_144] в
sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
~ [na: 1.8.0_144] в
sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
~ [na: 1.8.0_144] на java.lang.reflect.Method.invoke (Method.java:498)
~ [na: 1.8.0_144] в
org.springframework.web.method.support.InvocableHandlerMethod.doInvoke (InvocableHandlerMethod.java:221)
[spring-web-4.2.0.RELEASE.jar: 4.2.0.RELEASE] в
org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest (InvocableHandlerMethod.java:137)
[spring-web-4.2.0.RELEASE.jar: 4.2.0.RELEASE] в
org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle (ServletInvocableHandlerMethod.java:111)
[spring-webmvc-4.2.0.RELEASE.jar: 4.2.0.RELEASE] в
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod (RequestMappingHandlerAdapter.java:806)
[spring-webmvc-4.2.0.RELEASE.jar: 4.2.0.RELEASE] в
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal (RequestMappingHandlerAdapter.java:729)
[spring-webmvc-4.2.0.RELEASE.jar: 4.2.0.RELEASE] в
org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle (AbstractHandlerMethodAdapter.java:85)
[spring-webmvc-4.2.0.RELEASE.jar: 4.2.0.RELEASE] в
org.springframework.web.servlet.DispatcherServlet.doDispatch (DispatcherServlet.java:959)
[spring-webmvc-4.2.0.RELEASE.jar: 4.2.0.RELEASE] в
org.springframework.web.servlet.DispatcherServlet.doService (DispatcherServlet.java:893)
[spring-webmvc-4.2.0.RELEASE.jar: 4.2.0.RELEASE] в
com.imc.iss.web.config.IssDispatcherServlet.doService (IssDispatcherServlet.java:36)
[core-0.0.2-SNAPSHOT.jar: 0.0.2-SNAPSHOT] в
org.springframework.web.servlet.FrameworkServlet.processRequest (FrameworkServlet.java:970)
[spring-webmvc-4.2.0.RELEASE.jar: 4.2.0.RELEASE] в
org.springframework.web.servlet.FrameworkServlet.doGet (FrameworkServlet.java:861)
[spring-webmvc-4.2.0.RELEASE.jar: 4.2.0.RELEASE] в
javax.servlet.http.HttpServlet.service (HttpServlet.java:635)
[servlet-api.jar: na] в
org.springframework.web.servlet.FrameworkServlet.service (FrameworkServlet.java:846)
[spring-webmvc-4.2.0.RELEASE.jar: 4.2.0.RELEASE] в
javax.servlet.http.HttpServlet.service (HttpServlet.java:742)
[servlet-api.jar: na] в
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:231)[catalina.jar: na] в
org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:166)
[catalina.jar: na] в
org.apache.tomcat.websocket.server.WsFilter.doFilter (WsFilter.java:52)
[tomcat-websocket.jar: 8.5.23-dev] в
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:193)
[catalina.jar: na] в
org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:166)
[catalina.jar: na] в
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal (CharacterEncodingFilter.java:85)
[spring-web-4.2.0.RELEASE.jar: 4.2.0.RELEASE] в
org.springframework.web.filter.OncePerRequestFilter.doFilter (OncePerRequestFilter.java:107)
[spring-web-4.2.0.RELEASE.jar: 4.2.0.RELEASE] в
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:193)
[catalina.jar: na] в
org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:166)
[catalina.jar: na] в
com.sap.ui5.resource.AppCacheBusterFilter.doFilter (AppCacheBusterFilter.java:191)
[resource-1.38.4.jar: na] в
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:193)
[catalina.jar: na] в
org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:166)
[catalina.jar: na] в
org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy.java:316)
[spring-security-web-4.0.2.RELEASE.jar: 4.0.2.RELEASE] в
org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke (FilterSecurityInterceptor.java:126)
[spring-security-web-4.0.2.RELEASE.jar: 4.0.2.RELEASE] в
org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter (FilterSecurityInterceptor.java:90)
[spring-security-web-4.0.2.RELEASE.jar: 4.0.2.RELEASE] в
org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy.java:330)
[spring-security-web-4.0.2.RELEASE.jar: 4.0.2.RELEASE] в
org.springframework.security.web.access.ExceptionTranslationFilter.doFilter (ExceptionTranslationFilter.java:114)
[spring-security-web-4.0.2.RELEASE.jar: 4.0.2.RELEASE] в
org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy.java:330)
[spring-security-web-4.0.2.RELEASE.jar: 4.0.2.RELEASE] в
org.springframework.security.web.session.SessionManagementFilter.doFilter (SessionManagementFilter.java:122)
[spring-security-web-4.0.2.RELEASE.jar: 4.0.2.RELEASE] в
org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy.java:330)
[spring-security-web-4.0.2.RELEASE.jar: 4.0.2.RELEASE] в
org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter (AnonymousAuthenticationFilter.java:111)
[spring-security-web-4.0.2.RELEASE.jar: 4.0.2.RELEASE] в
org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy.java:330)
[spring-security-web-4.0.2.RELEASE.jar: 4.0.2.RELEASE] в
org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter (SecurityContextHolderAwareRequestFilter.java:169)
[spring-security-web-4.0.2.RELEASE.jar: 4.0.2.RELEASE] в
org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy.java:330)
[spring-security-web-4.0.2.RELEASE.jar: 4.0.2.RELEASE] в
org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter (RequestCacheAwareFilter.java:48)
[spring-security-web-4.0.2.RELEASE.jar: 4.0.2.RELEASE] в
org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy.java:330)
[spring-security-web-4.0.2.RELEASE.jar: 4.0.2.RELEASE] вorg.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilterInternal (BasicAuthenticationFilter.java:158)
[spring-security-web-4.0.2.RELEASE.jar: 4.0.2.RELEASE] в
org.springframework.web.filter.OncePerRequestFilter.doFilter (OncePerRequestFilter.java:107)
[spring-web-4.2.0.RELEASE.jar: 4.2.0.RELEASE] в
org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy.java:330)
[spring-security-web-4.0.2.RELEASE.jar: 4.0.2.RELEASE] в
org.springframework.security.web.session.ConcurrentSessionFilter.doFilter (ConcurrentSessionFilter.java:133)
[spring-security-web-4.0.2.RELEASE.jar: 4.0.2.RELEASE] в
org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy.java:330)
[spring-security-web-4.0.2.RELEASE.jar: 4.0.2.RELEASE] в
org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter (AbstractAuthenticationProcessingFilter.java:205)
[spring-security-web-4.0.2.RELEASE.jar: 4.0.2.RELEASE] в
org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy.java:330)
[spring-security-web-4.0.2.RELEASE.jar: 4.0.2.RELEASE] в
org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilterInternal (BasicAuthenticationFilter.java:158)
[spring-security-web-4.0.2.RELEASE.jar: 4.0.2.RELEASE] в
org.springframework.web.filter.OncePerRequestFilter.doFilter (OncePerRequestFilter.java:107)
[spring-web-4.2.0.RELEASE.jar: 4.2.0.RELEASE] в
org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy.java:330)
[spring-security-web-4.0.2.RELEASE.jar: 4.0.2.RELEASE] в
org.springframework.security.web.authentication.logout.LogoutFilter.doFilter (LogoutFilter.java:120)
[spring-security-web-4.0.2.RELEASE.jar: 4.0.2.RELEASE] в
org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy.java:330)
[spring-security-web-4.0.2.RELEASE.jar: 4.0.2.RELEASE] в
org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter (SecurityContextPersistenceFilter.java:91)
[spring-security-web-4.0.2.RELEASE.jar: 4.0.2.RELEASE] в
org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy.java:330)
[spring-security-web-4.0.2.RELEASE.jar: 4.0.2.RELEASE] в
org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal (WebAsyncManagerIntegrationFilter.java:53)
[spring-security-web-4.0.2.RELEASE.jar: 4.0.2.RELEASE] в
org.springframework.web.filter.OncePerRequestFilter.doFilter (OncePerRequestFilter.java:107)
[spring-web-4.2.0.RELEASE.jar: 4.2.0.RELEASE] в
org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy.java:330)
[spring-security-web-4.0.2.RELEASE.jar: 4.0.2.RELEASE] в
org.springframework.security.web.FilterChainProxy.doFilterInternal (FilterChainProxy.java:213)
[spring-security-web-4.0.2.RELEASE.jar: 4.0.2.RELEASE] в
org.springframework.security.web.FilterChainProxy.doFilter (FilterChainProxy.java:176)
[spring-security-web-4.0.2.RELEASE.jar: 4.0.2.RELEASE] в
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate (DelegatingFilterProxy.java:346)
[spring-web-4.2.0.RELEASE.jar: 4.2.0.RELEASE] в
org.springframework.web.filter.DelegatingFilterProxy.doFilter (DelegatingFilterProxy.java:262)
[spring-web-4.2.0.RELEASE.jar: 4.2.0.RELEASE] в
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:193)
[catalina.jar: na] в
org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:166)
[catalina.jar: na] в
org.apache.catalina.core.StandardWrapperValve.invoke (StandardWrapperValve.java:198)
[catalina.jar: na] вorg.apache.catalina.core.StandardContextValve.invoke (StandardContextValve.java:96)
[catalina.jar: na] в
org.apache.catalina.authenticator.AuthenticatorBase.invoke (AuthenticatorBase.java:478)
[catalina.jar: na] в
org.apache.catalina.core.StandardHostValve.invoke (StandardHostValve.java:140)
[catalina.jar: na] в
org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:81)
[catalina.jar: na] в
org.apache.catalina.valves.AbstractAccessLogValve.invoke (AbstractAccessLogValve.java:650)
[catalina.jar: na] в
org.apache.catalina.core.StandardEngineValve.invoke (StandardEngineValve.java:87)
[catalina.jar: na] в
org.apache.catalina.connector.CoyoteAdapter.service (CoyoteAdapter.java:342)
[catalina.jar: na] в
org.apache.coyote.http11.Http11Processor.service (Http11Processor.java:803)
[tomcat-coyote.jar: 8.5.23-dev] в
org.apache.coyote.AbstractProcessorLight.process (AbstractProcessorLight.java:66)
[tomcat-coyote.jar: 8.5.23-dev] в
org.apache.coyote.AbstractProtocol $ ConnectionHandler.process (AbstractProtocol.java:868)
[tomcat-coyote.jar: 8.5.23-dev] в
org.apache.tomcat.util.net.NioEndpoint $ SocketProcessor.doRun (NioEndpoint.java:1459)
[tomcat-coyote.jar: 8.5.23-dev] в
org.apache.tomcat.util.net.SocketProcessorBase.run (SocketProcessorBase.java:49)
[tomcat-coyote.jar: 8.5.23-dev] в
java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1149)
[na: 1.8.0_144] в
java.util.concurrent.ThreadPoolExecutor $ Worker.run (ThreadPoolExecutor.java:624)
[na: 1.8.0_144] в
org.apache.tomcat.util.threads.TaskThread $ WrappingRunnable.run (TaskThread.java:61)
[tomcat-util.jar: 8.5.23-dev] на java.lang.Thread.run (Thread.java:808)
[na: 1.8.0_144] Причина: java.lang.NoClassDefFoundError:
org / jxls / transform / poi / PoiCellData $ 1: не может инициализировать класс, потому что
предыдущая попытка инициализации не удалась в
org.jxls.transform.poi.PoiCellData.readCellContents (PoiCellData.java:88)
~ [jxls-poi-1.0.14.jar: na] в
org.jxls.transform.poi.PoiCellData.readCell (PoiCellData.java:54)
~ [jxls-poi-1.0.14.jar: na] в
org.jxls.transform.poi.PoiCellData.createCellData (PoiCellData.java:47)
~ [jxls-poi-1.0.14.jar: na] в
org.jxls.transform.poi.PoiRowData.createRowData (PoiRowData.java:26)
~ [jxls-poi-1.0.14.jar: na] в
org.jxls.transform.poi.PoiSheetData.createSheetData (PoiSheetData.java:28)
~ [jxls-poi-1.0.14.jar: na] в
org.jxls.transform.poi.PoiTransformer.readCellData (PoiTransformer.java:117)
~ [jxls-poi-1.0.14.jar: na] в
org.jxls.transform.poi.PoiTransformer.createTransformer (PoiTransformer.java:71)
~ [jxls-poi-1.0.14.jar: na] в
org.jxls.transform.poi.PoiTransformer.createTransformer (PoiTransformer.java:66)
~ [jxls-poi-1.0.14.jar: na] в
org.jxls.transform.poi.PoiTransformer.createTransformer (PoiTransformer.java:58)
~ [jxls-poi-1.0.14.jar: na] ... 106 общих кадров опущено
java.lang.NoClassDefFoundError: org / apache / poi / ss / usermodel / CellType
в org.jxls.transform.poi.PoiCellData $ 1. (PoiCellData.java:88)
~ [jxls-poi-1.0.14.jar: na] в
org.jxls.transform.poi.PoiCellData.readCellContents (PoiCellData.java:88)
~ [jxls-poi-1.0.14.jar: na] в
org.jxls.transform.poi.PoiCellData.readCell (PoiCellData.java:54)
~ [jxls-poi-1.0.14.jar: na] в
org.jxls.transform.poi.PoiCellData.createCellData (PoiCellData.java:47)
~ [jxls-poi-1.0.14.jar: na] в
org.jxls.transform.poi.PoiRowData.createRowData (PoiRowData.java:26)
~ [jxls-poi-1.0.14.jar: na] в
org.jxls.transform.poi.PoiSheetData.createSheetData (PoiSheetData.java:28)
~ [jxls-poi-1.0.14.jar: na] в
org.jxls.transform.poi.PoiTransformer.readCellData (PoiTransformer.java:117)
~ [jxls-poi-1.0.14.jar: na] в
org.jxls.transform.poi.PoiTransformer.createTransformer (PoiTransformer.java:71)
~ [jxls-poi-1.0.14.jar: na] в
org.jxls.transform.poi.PoiTransformer.createTransformer (PoiTransformer.java:66)~ [jxls-poi-1.0.14.jar: na] в
org.jxls.transform.poi.PoiTransformer.createTransformer (PoiTransformer.java:58)
~ [jxls-poi-1.0.14.jar: na] в
sun.reflect.NativeMethodAccessorImpl.invoke0 (собственный метод)
~ [na: 1.8.0_144] в
sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
~ [na: 1.8.0_144] в
sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
~ [na: 1.8.0_144] на java.lang.reflect.Method.invoke (Method.java:498)
~ [na: 1.8.0_144] в
org.jxls.util.TransformerFactory.createTransformer (TransformerFactory.java:35)
~ [jxls-2.4.3.jar: na] в
com.imc.iss.web.report.impl.JXLSFiller.generateWorkbook (JXLSFiller.java:409)
[core-0.0.2-SNAPSHOT.jar: 0.0.2-SNAPSHOT] в
com.imc.iss.web.report.impl.JXLSFiller.generateQuoteBasedWorkbook (JXLSFiller.java:364)
[core-0.0.2-SNAPSHOT.jar: 0.0.2-SNAPSHOT] в
com.imc.iss.web.report.impl.JXLSFiller.access $ 1 (JXLSFiller.java:338)
[core-0.0.2-SNAPSHOT.jar: 0.0.2-SNAPSHOT] в
com.imc.iss.web.report.impl.JXLSFiller $ 1.execute (JXLSFiller.java:168)
[core-0.0.2-SNAPSHOT.jar: 0.0.2-SNAPSHOT] в
com.imc.iss.web.report.impl.JXLSFiller $ 1.execute (JXLSFiller.java:1)
[core-0.0.2-SNAPSHOT.jar: 0.0.2-SNAPSHOT] в
... 116 общих кадров пропущено