Have a look to ZipInputStreamZipEntrySource.java line 117
https://svn.apache.org/repos/asf/poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/util/ZipInputStreamZipEntrySource.java

Francois

Le 25 août 2012 à 09:01, sdia1400 a écrit :

> Using eclipse/tomcat, I have a single page wicket app with a single link for
> downloading an excel sheet (*.xlsm, around 6MB) and it works, great. 
> However, when I plug the same piece of code in my main web application
> (wicket + spring + hibernate + mysql), it throws 
> "java.io.IOException: ZIP entry size is too large". I am not able to figure
> out the problem. I suspect it has something to do with springframe that I
> use in my main web app. 
> 
> Here is the exception 
> 
> java.io.IOException: ZIP entry size is too large 
>        at
> org.apache.poi.openxml4j.util.ZipInputStreamZipEntrySource$FakeZipEntry.<init>(ZipInputStreamZipEntrySource.java:117)
>  
>        at
> org.apache.poi.openxml4j.util.ZipInputStreamZipEntrySource.<init>(ZipInputStreamZipEntrySource.java:55)
>  
>        at
> org.apache.poi.openxml4j.opc.ZipPackage.<init>(ZipPackage.java:83) 
>        at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:228) 
>        at org.apache.poi.util.PackageHelper.open(PackageHelper.java:39) 
>        at
> org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:187) 
>        at
> com.fhlabs.app.DownloadGeneratedExcelPage1$1$1.getData(DownloadGeneratedExcelPage1.java:39)
>  
>        at
> org.apache.wicket.request.resource.ByteArrayResource.newResourceResponse(ByteArrayResource.java:101)
>  
>        at
> org.apache.wicket.request.resource.AbstractResource.respond(AbstractResource.java:477)
>  
>        at
> org.apache.wicket.request.handler.resource.ResourceRequestHandler.respond(ResourceRequestHandler.java:77)
>  
>        at
> org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:712)
>  
>        at
> org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:63)
>  
>        at
> org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:96)
>  
>        at
> org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:208)
>  
>        at
> org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:251)
>  
>        at
> org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:162)
>  
>        at
> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:218) 
>        at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
>  
>        at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
>  
>        at
> org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:113)
>  
>        at
> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
>  
>        at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
>  
>        at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
>  
>        at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
>  
>        at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
>  
>        at
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
>  
>        at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168) 
>        at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100) 
>        at
> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929) 
>        at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
>  
>        at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405) 
>        at
> org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:964)
>  
>        at
> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515)
>  
>        at
> org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:304)
>  
>        at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>  
>        at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>  
>        at java.lang.Thread.run(Thread.java:662) 
> 
> 
>    Here is the code... 
> public class DownloadGeneratedExcelPage1 extends WebPage { 
>        private static final long serialVersionUID = 1L; 
>        public DownloadGeneratedExcelPage1() { 
>                add(new Link<Void>("download") { 
>                        private static final long serialVersionUID = 1L; 
> 
>                        @Override 
>                        public void onClick() { 
>                                final IResource resource = new
> ByteArrayResource( 
>                                                "application/vnd.ms-excel")
> { 
>                                        private static final long
> serialVersionUID = 1L; 
> 
>                                        @Override 
>                                        protected byte[] getData(Attributes
> attributes) { 
>                                                InputStream in =
> DownloadGeneratedExcelPage1.class 
> 
> .getResourceAsStream("/templates/excelTest.xlsm"); 
>                                                ByteArrayOutputStream os =
> new ByteArrayOutputStream(); 
>                                                try { 
>                                                        XSSFWorkbook
> workBook = new XSSFWorkbook(in); 
>                                                        workBook.write(os); 
>                                                } catch (IOException ex) { 
> 
> ex.printStackTrace(); 
>                                                } 
>                                                return os.toByteArray(); 
>                                        } 
> 
>                                        @Override 
>                                        protected void
> setResponseHeaders(ResourceResponse data, 
>                                                        Attributes
> attributes) { 
>                                                SimpleDateFormat df = new
> SimpleDateFormat( 
> 
> "yyyy.MM.dd_HHmm"); 
>                                                data.setFileName("testFile_" 
>                                                                +
> df.format(new Date()) + ".xlsm"); 
>                                                data.disableCaching(); 
> 
> super.setResponseHeaders(data, attributes); 
>                                        } 
>                                }; 
>                                IRequestHandler handler = new
> ResourceRequestHandler(resource, 
>                                                null); 
> 
> getRequestCycle().scheduleRequestHandlerAfterCurrent(handler); 
>                        } 
>                }); 
>        } 
> } 
> 
> I would highly appreciate your feedback. Many thanks.
> 
> 
> 
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/IOException-ZIP-entry-size-is-too-large-when-downloading-excel-file-tp4651492.html
> Sent from the Users forum mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to