concordion / concordion-excel-extension

Allows Concordion specifications to be in Excel format rather than HTML
Other
9 stars 12 forks source link

ZipException when opening excel files #4

Closed GoGoris closed 8 years ago

GoGoris commented 8 years ago

Hi, we would really like to use your extension in our team as it would greatly improve our workflow. Unfortunately I always get a ZipException when i try running my test (stacktrace below). I tried the following steps, but without succes:

Maybe the reason is that I am using Excel version 2013? I know that you are probably maintaining this project in your free time (like most projects on github), but any help will be greatly appreciated.

Here is the stacktrace:

org.concordion.ext.excel.ExcelConversionException: java.util.zip.ZipException: invalid stored block lengths

    at org.concordion.ext.excel.conversion.workbook.WorkbookHelper.getWorkbook(WorkbookHelper.java:28)
    at org.concordion.ext.excel.conversion.workbook.BasicWorkbookConversionStrategy.process(BasicWorkbookConversionStrategy.java:20)
    at org.concordion.ext.excel.conversion.workbook.BasicWorkbookConversionStrategy.process(BasicWorkbookConversionStrategy.java:10)
    at org.concordion.ext.excel.ExcelClassPathSource.createInputStream(ExcelClassPathSource.java:37)
    at org.concordion.internal.XMLSpecificationReader.readSpecification(XMLSpecificationReader.java:25)
    at org.concordion.Concordion.process(Concordion.java:30)
    at org.concordion.Concordion.process(Concordion.java:26)
    at org.concordion.internal.FixtureRunner.run(FixtureRunner.java:21)
    at org.concordion.integration.junit4.ConcordionRunner$1.evaluate(ConcordionRunner.java:118)
    at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)
    at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)
    at org.springframework.test.context.junit4.statements.RunPrepareTestInstanceCallbacks.evaluate(RunPrepareTestInstanceCallbacks.java:64)
    at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
    at org.springframework.test.context.junit4.statements.SpringFailOnTimeout.evaluate(SpringFailOnTimeout.java:87)
    at org.springframework.test.context.junit4.statements.ProfileValueChecker.evaluate(ProfileValueChecker.java:103)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    at org.concordion.integration.junit4.ConcordionRunner.runChild(ConcordionRunner.java:109)
    at org.concordion.integration.junit4.ConcordionRunner.runChild(ConcordionRunner.java:20)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
    at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
    at org.springframework.test.context.junit4.statements.ProfileValueChecker.evaluate(ProfileValueChecker.java:103)
    at org.springframework.test.context.junit4.rules.SpringClassRule$TestContextManagerCacheEvictor.evaluate(SpringClassRule.java:248)
    at org.junit.rules.RunRules.evaluate(RunRules.java:20)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
    at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74)
    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:497)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
Caused by: java.util.zip.ZipException: invalid stored block lengths
    at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:164)
    at java.util.zip.ZipInputStream.read(ZipInputStream.java:194)
    at java.io.FilterInputStream.read(FilterInputStream.java:107)
    at org.apache.poi.openxml4j.util.ZipInputStreamZipEntrySource$FakeZipEntry.<init>(ZipInputStreamZipEntrySource.java:127)
    at org.apache.poi.openxml4j.util.ZipInputStreamZipEntrySource.<init>(ZipInputStreamZipEntrySource.java:55)
    at org.apache.poi.openxml4j.opc.ZipPackage.<init>(ZipPackage.java:84)
    at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:272)
    at org.apache.poi.util.PackageHelper.open(PackageHelper.java:39)
    at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:218)
    at org.concordion.ext.excel.conversion.workbook.WorkbookHelper.getWorkbook(WorkbookHelper.java:26)
    ... 38 more
robmoffat commented 8 years ago

Hi Steven,

One thing that occurs to me straight off is that there is something about your Excel file that cannot be processed using POI: seems like POI can’t process this spreadsheet.

A couple of things for you to try: what happens if you replace your spreadsheet with just a completely new, blank spreadsheet? what happens if you instead use the spreadsheet from the tutorial?

In earlier versions of POI/Excel I’ve seen issues with compatibility with certain features like Pivot tables, but I haven’t seen that for a long time now.

Let me know how you go with those two tests and we’ll progress from there.

cheers,

Rob

On 11 Jan 2016, at 15:48, Steven Goris notifications@github.com wrote:

Hi, we would really like to use your extension in our team as it would greatly improve our workflow. Unfortunately I always get a ZipException when i try running my test (stacktrace below). I tried the following steps, but without succes:

I tried an older version of concordion (1.4.7) and of your plugin (1.0.2) I tried cloning this project and building again with apache-poi 3.13 I tried saving as Strict Open XML and as the default excel format Maybe the reason is that I am using Excel version 2013? I know that you are probably maintaining this project in your free time (like most projects on github), but any help will be greatly appreciated.

Here is the stacktrace:

org.concordion.ext.excel.ExcelConversionException: java.util.zip.ZipException: invalid stored block lengths

at org.concordion.ext.excel.conversion.workbook.WorkbookHelper.getWorkbook(WorkbookHelper.java:28)
at org.concordion.ext.excel.conversion.workbook.BasicWorkbookConversionStrategy.process(BasicWorkbookConversionStrategy.java:20)
at org.concordion.ext.excel.conversion.workbook.BasicWorkbookConversionStrategy.process(BasicWorkbookConversionStrategy.java:10)
at org.concordion.ext.excel.ExcelClassPathSource.createInputStream(ExcelClassPathSource.java:37)
at org.concordion.internal.XMLSpecificationReader.readSpecification(XMLSpecificationReader.java:25)
at org.concordion.Concordion.process(Concordion.java:30)
at org.concordion.Concordion.process(Concordion.java:26)
at org.concordion.internal.FixtureRunner.run(FixtureRunner.java:21)
at org.concordion.integration.junit4.ConcordionRunner$1.evaluate(ConcordionRunner.java:118)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)
at org.springframework.test.context.junit4.statements.RunPrepareTestInstanceCallbacks.evaluate(RunPrepareTestInstanceCallbacks.java:64)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
at org.springframework.test.context.junit4.statements.SpringFailOnTimeout.evaluate(SpringFailOnTimeout.java:87)
at org.springframework.test.context.junit4.statements.ProfileValueChecker.evaluate(ProfileValueChecker.java:103)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.concordion.integration.junit4.ConcordionRunner.runChild(ConcordionRunner.java:109)
at org.concordion.integration.junit4.ConcordionRunner.runChild(ConcordionRunner.java:20)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at org.springframework.test.context.junit4.statements.ProfileValueChecker.evaluate(ProfileValueChecker.java:103)
at org.springframework.test.context.junit4.rules.SpringClassRule$TestContextManagerCacheEvictor.evaluate(SpringClassRule.java:248)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74)
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:497)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)

Caused by: java.util.zip.ZipException: invalid stored block lengths at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:164) at java.util.zip.ZipInputStream.read(ZipInputStream.java:194) at java.io.FilterInputStream.read(FilterInputStream.java:107) at org.apache.poi.openxml4j.util.ZipInputStreamZipEntrySource$FakeZipEntry.(ZipInputStreamZipEntrySource.java:127) at org.apache.poi.openxml4j.util.ZipInputStreamZipEntrySource.(ZipInputStreamZipEntrySource.java:55) at org.apache.poi.openxml4j.opc.ZipPackage.(ZipPackage.java:84) at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:272) at org.apache.poi.util.PackageHelper.open(PackageHelper.java:39) at org.apache.poi.xssf.usermodel.XSSFWorkbook.(XSSFWorkbook.java:218) at org.concordion.ext.excel.conversion.workbook.WorkbookHelper.getWorkbook(WorkbookHelper.java:26) ... 38 more — Reply to this email directly or view it on GitHub https://github.com/concordion/concordion-excel-extension/issues/4.

GoGoris commented 8 years ago

I copied the spreadsheet and Test-classes from the tutorial and I still get an exception on the zip entry size.

org.concordion.ext.excel.ExcelConversionException: java.io.IOException: ZIP entry size is too large

    at org.concordion.ext.excel.conversion.workbook.WorkbookHelper.getWorkbook(WorkbookHelper.java:28)
    at org.concordion.ext.excel.conversion.workbook.BasicWorkbookConversionStrategy.process(BasicWorkbookConversionStrategy.java:20)
    at org.concordion.ext.excel.conversion.workbook.BasicWorkbookConversionStrategy.process(BasicWorkbookConversionStrategy.java:10)
    at org.concordion.ext.excel.ExcelClassPathSource.createInputStream(ExcelClassPathSource.java:37)
    at org.concordion.internal.XMLSpecificationReader.readSpecification(XMLSpecificationReader.java:25)
    at org.concordion.Concordion.process(Concordion.java:31)
    at org.concordion.Concordion.process(Concordion.java:26)
    at org.concordion.internal.FixtureRunner.run(FixtureRunner.java:24)
    at org.concordion.integration.junit4.ConcordionRunner$1.evaluate(ConcordionRunner.java:125)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    at org.concordion.integration.junit4.ConcordionRunner.runChild(ConcordionRunner.java:115)
    at org.concordion.integration.junit4.ConcordionRunner.runChild(ConcordionRunner.java:21)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
    at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74)
    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:497)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
Caused by: 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:84)
    at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:272)
    at org.apache.poi.util.PackageHelper.open(PackageHelper.java:39)
    at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:218)
    at org.concordion.ext.excel.conversion.workbook.WorkbookHelper.getWorkbook(WorkbookHelper.java:26)
    ... 27 more
robmoffat commented 8 years ago

Could this be something to do with your maven settings, as suggested here:

http://stackoverflow.com/questions/22919337/why-am-i-getting-exception-ioexception-zip-entry-size-is-too-large-when-tryin http://stackoverflow.com/questions/22919337/why-am-i-getting-exception-ioexception-zip-entry-size-is-too-large-when-tryin

It could be that you are doing some processing resources step which is corrupting the zip file?

thanks,

Rob

On 12 Jan 2016, at 09:57, Steven Goris notifications@github.com wrote:

I copied the spreadsheet and Test-classes from the tutorial and I still get an exception on the zip entry size.

org.concordion.ext.excel.ExcelConversionException: java.io.IOException: ZIP entry size is too large

GoGoris commented 8 years ago

You are right, something is wrong with the excel file in the target directory. Thanks for your help! I'm gonna search now what is causing this.

GoGoris commented 8 years ago

Thank you, my problem is solved! You have to make sure that you don't have resource filtering on in your pom.xml:

            <testResource>
                <directory>src/test/resources</directory>
                <!-- Important! don't filter binary files -->
                <filtering>false</filtering>
                <!-- If using concordion excel extension -->
                <excludes>
                    <exclude>**/~$*.xlsx</exclude>
                </excludes>
            </testResource>
robmoffat commented 6 years ago

Hi Jonathan,

Are you using the concordion excel extension? Or is this just a general maven issue?

Thanks, Rob

On 12 May 2018, at 00:15, Jonathan Marin notifications@github.com wrote:

Hi guys, i have the same problem, But this solution doesn't work for me... i don't know why, the file.docx is corrupted once i've compiled, so it seems that maven corrupts file.docx. i try to open it manually and it's damage, i change the file.docx by origninal file.docx into tomcat and finally this work ... but i want that maven copy this file correctly... Yes i know this post have 2 years .. but if someone knows what is wrong (E.g. Pom's configuration) hope may help me.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

Anceloth commented 6 years ago

Hi Rob. First of all, thank you for reply my message.

It is not a excel file, is a word file .docx. that's why i dropped my question....

in the POM i have <artifactId>poi-ooxml</artifactId> ..

and I solved the problem with this configuration in POM:

`<plugin>`
    <artifactId>maven-resources-plugin</artifactId>
    <version>3.1.0</version>
    <executions>
         <execution>
          <id>copy-resources</id>
          <!-- here the phase you need -->
           <phase>compile</phase> 
           <goals>
             <goal>copy-resources</goal>
           </goals>     
               <configuration>
                 <encoding>UTF-8</encoding>  
                 <outputDirectory>${basedir}/WEB-INF/classes</outputDirectory>
                 <nonFilteredFileExtensions>
                    <nonFilteredFileExtension>docx</nonFilteredFileExtension>
                <nonFilteredFileExtension>xlsx</nonFilteredFileExtension>
                 </nonFilteredFileExtensions>
          <!-- <outputDirectory>${project.build.directory}/${project.artifactId}-${project.version}/WEB-INF/classes</outputDirectory> -->
            <resources>
                       <resource>
                          <directory>src/main/resources</directory>
                  <filtering>false</filtering>
                  <includes>
                       <include>**/*.docx</include>
                  </includes>
                  </resource>                           
                         </resources>
            </configuration>           
        </execution>
      </executions>
    </plugin>

The file.docx is correctly copied. That context probably does not corresponding to this topic or maybe yes , is a ZipException too ... But in this case the problem was when i compile, and the word file.docx is not copied correctly to /WEB-INF/classes. The trace is this--

java.io.IOException: Failed to read zip entry source .......... Caused by: java.io.IOException: ZIP entry size is too large