RandomAccessSource not opened
最近在使用word模板生成pdf,一开始由于一些流没有关闭,导致内存溢出,出现"too many open files",后来就对代码中流和读写对象一通关闭。
代码调整之后,本以为可以完美的解决问题,结果又出现一个莫名的异常“java.io.IOException: RandomAccessSource not opened”,问度娘吧,没有找到合理的解决办法。然后就可以研究代码,从代码上看,真没什么问题啊。
之后就不禁怀疑,是不是哪里的流关早了,还是不该关的流关错了。
从堆栈信息来看,发现异常是打在pdfStamper.close()方法上的,
最后查看代码,在关闭stamper之前,关闭了构建stamper对象的os和reader,如下:
最后将stamper.close()放到最上边,即先关闭stamper,在关闭os和reader,测试一下,完美解决!!!终于可以歇歇了
RandomAccessSource not opened相关推荐
- JAVA itext 多种文件转pdf,进行合并 添加水印
结合网上各路大神代码汇总而来,如果需要将pdf统一格式,可将pdf转成图片后重新转为pdf合并至一起,使用itext的PdfCanvas未成功解决该问题,主要也是因为我菜且时间紧没空查文档了.对于it ...
- The file “Info.plist” couldn’t be opened because there is no such file
修改了Info.plist的实际文件位置(项目和单元测试对应不同的Info.plist),报错 (null): could not read data from '/Users/xxxxx/Deskt ...
- “XXXXX” is damaged and can’t be opened. You should move it to the Trash 解决方案
苹果为了我们的软件安全也是操碎了心,很多小伙伴发现下载自各种第三方的软件在使用时都会弹出: "XXXXX" is damaged and can't be opened. You ...
- “Can’t be opened because Apple cannot check it for malicious software“ 解决方案
"Can't be opened because Apple cannot check it for malicious software" 解决方案 参考文章: (1)" ...
- class path resource [beans.xml] cannot be opened because it does not exist
严重: Exception sending context initialized event to listener instance of class org.springframework.we ...
- 解决spring的xml文件cannot be open ( class path resource cannot be opened)
xml文件一直显示cannot be open 报错语句有一条: class path resource [bean2.xml] cannot be opened because it does no ...
- This file can not be opened as a file descriptor; it is probably compressed
链接:FileNotFoundException: This file can not be opened as a file descriptor; it is probably compresse ...
- 【错误解决】[Maven] cannot be opened because it does not exist错误[文件无法编译到target目录下的解决方法]...
转载请注明出处:http://blog.csdn.net/qq_26525215 本文源自[大学之旅_谙忆的博客] 使用IDEA搭建的Maven项目,在写SpringEL和资源调用时出现了如下错误: ...
- Storyboard.storyboard could not be opened. Could not read the archive.
Storyboard.storyboard could not be opened. Could not read the archive. Please use a newer version o ...
- VS2005、VS2010等VS系列IDE在MFC开发过程中,Resource View标签打不开,问题为“opened in other editor”
问题描述: VS2005.VS2010等VS系列IDE在MFC开发过程中,Resource View标签打不开,问题为"opened in other editor" 可能原因: ...
最新文章
- tongweb安装部署_Linux系统东方通部署iserver说明
- 通过电脑给继电器发送指令_三菱FX PLC学习之通信指令(上)
- WebLogic中文博客
- mysql分片库分页查询_mysql数据库分页查询优化
- 一天一个设计模式之建造者模式(Builder)
- 《大数据》第1期——创刊寄语
- spring 5.x(1)-----Spring Framework 5.x中的新功能
- 【词向量】从Word2Vec到Bert,聊聊词向量的前世今生(一)
- Linq中Average,Sum等方法的使用解析
- 防盗链与token运用
- 通过分区(Partitioning)提高Spark的运行性能
- java session机制_如何学习Session的机制使用
- firefox vimperator (图)
- Win11 WSA 安卓子系统 下载安装更新
- uniapp 自定义头部 支持微信、百度、头条小程序
- Android应用自启动保活手段与安全现状分析
- Java 实现回文数
- 跟着别人学学优化自己的Ubuntu 操作系统
- 程序猿思维释放:打破常态
- 操作系统之文件管理(一)
热门文章
- App Tamer for Mac(CPU优化电池管理工具)特别版
- TCP Congestion性能测试分析
- FlexBox 行间距
- 人工智能管家机器人应当具备哪些功能?拥有家电控制能力是优势
- 基于三层交换技术的校园网设计与实现
- 双色F3.75LED点阵屏中保护电路74HC04的作用
- 如何判断三极管的集电极,基极和发射极?
- Django Q查询
- neo4j springboot 日志_springBoot 与neo4j的简单整合示例
- 青岛科技大学计算机转专业,2021年青岛科技大学大一新生转专业及入学考试相关规定...