最近在研究利用sax读取excel大文件时,出现了以下的错误:

java.lang.IllegalStateException: Zip File is closed
 at org.apache.poi.openxml4j.util.ZipFileZipEntrySource.getEntries(ZipFileZipEntrySource.java:45)
 at org.apache.poi.openxml4j.opc.ZipPackage.getPartsImpl(ZipPackage.java:161)
 at org.apache.poi.openxml4j.opc.OPCPackage.getParts(OPCPackage.java:662)
 at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:223)
 at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:186)
 at com.speed.excel.Excel2007Reader.process(Excel2007Reader.java:80)

要是按字面意思来看,是Zip文件关闭了,其实不然,这是由于在读取excel代码时将文件目录E:\\taskTemplate.xls(正确的excel2003格式)写成了E:\\taskTemplate.xlsx,造成的结果,于是好奇的又试了一下将原本存在的

E:\\新建 Microsoft Excel 工作表.xlsx文件改成了E:\\新建 Microsoft Excel 工作表.xls,此时报的错变成了

java.io.FileNotFoundException: E:\新建 Microsoft Excel 工作表.xls (系统找不到指定的文件。),

所以,在处理两种excel读取时一定要注意,因为两种读取excel方式不一致造成文件名写错,报出的异常也会不同,切不可望文生义。

java.lang.IllegalStateException: Zip File is closed的更多相关文章

  1. 解决java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext这个问题

    今天在运行别人的SSH项目时,遇到了这个问题 严重: Exception sending context initialized event to listener instance of class ...

  2. Android开发之Okhttp:java.lang.IllegalStateException: closed

    在使用Okhttp的时候 运行到response.body().string()一步时抛异常,java.lang.IllegalStateException: closed 查阅各种资料大致意思是Th ...

  3. 云笔记项目- 上传文件报错"java.lang.IllegalStateException: File has been moved - cannot be read again"

    在做文件上传时,当写入上传的文件到文件时,会报错“java.lang.IllegalStateException: File has been moved - cannot be read again ...

  4. Eclipse------使用Debug As时报错java.lang.IllegalStateException: Failed to read Class-Path attribute from manifest of jar file:/XXX

    报错信息: java.lang.IllegalStateException: Failed to read Class-Path attribute from manifest of jar file ...

  5. java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext

    spring的项目中有时候会报错:java.lang.IllegalStateException: BeanFactory not initialized or already closed - ca ...

  6. 解决java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext问题

    使用ClassPathXmlApplicationContext加载项目时, ClassPathXmlApplicationContext context = new ClassPathXmlAppl ...

  7. Android开发中使用数据库时出现java.lang.IllegalStateException: Cannot perform this operation because the connection pool has been closed.

    最近在开发一个 App 的时候用到了数据库,可是在使用数据库的时候就出现了一些问题,在我查询表中的一些信息时出现了一下问题: Caused by: java.lang.IllegalStateExce ...

  8. 项目启动异常,java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext

    java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' befo ...

  9. myeclipse 无法启动 java.lang.IllegalStateException: Unable to acquire application service. Ensure that the org.eclipse.core.runtime bundle is resolved and started (see config.ini).

    把myeclipse10 按照目录完整拷贝到了另外一台电脑, 另外的目录 原安装目录 D\:\soft\i\myeclipse10 新安装目录 E\:\soft\myeclipse10 双击启动失败, ...

随机推荐

  1. div滚动条时div内容显示一半

    本文为博主原创,未经允许不得转载 今天在做页面浏览器适配时,将页面中的一个div进行放大时,出现了滚动条,但滚动条对应div中的 内容只能显示一半. 仔细对应属性样式时,div具有overflow:h ...

  2. TensorFlow上实践基于自编码的One Class Learning

    “我不知道什么是爱,但我知道什么是不爱” --One Class Learning的自白 一.单分类简介 如果将分类算法进行划分,根据类别个数的不同可以分为单分类.二分类.多分类,常见的分类算法主要解 ...

  3. MVC ---- 如何使用Action委托

    先建立一个Serven 类 public class Seven { public static void TestSeven1() { List<User> userList = Fiv ...

  4. JSON序列化反序列化

    JSON(全称为JavaScript Object Notation) 是一种轻量级的数据交换格式.它是基于JavaScript语法标准的一个子集. JSON采用完全独立于语言的文本格式,可以很容易在 ...

  5. vmware 安装ubuntu

    点击自定义硬件 即将完毕 下面就是安装啦

  6. 8天掌握EF的Code First开发

    C#高级知识点&(ABP框架理论学习高级篇)——白金版 http://www.cnblogs.com/farb/p/ABPAdvancedTheoryContent.html

  7. dns未设置 PHP Warning: file_get_contents():php_network_getaddresses: getaddrinfo failed:

    php通过去访问外部网站时,出现以下提示: PHP Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed ...

  8. 探索gff/gtf格式

    参考: GFF格式说明 Generic Feature Format Version 3 (GFF3) 先下载一个 gtf 文件浏览一下 1 havana gene 11869 14409 . + . ...

  9. CentOS7.6 yum install Git

    1. yum install git 2. git version or git –version 3. uninstall:  git remove

  10. 解析XML文档大致流程以及相关方法

    ---恢复内容开始--- 使用dom解析XML文档的大致流程(要导入dom4j)1:创建SAXReader2:使用SAXReader读取xml文档,并生成对应的Document对象,该对象保存了该文档 ...