Can not find a java.io.InputStream with the name [inputStream] in the invocation stack
来源:互联网 发布:可可网络验证x系列 编辑:程序博客网 时间:2024/06/06 04:13
我在做Excel文件导出的时候,业务 和 实现 不是写在一个系统里面的,所以输出的时候用的是以字节流的形式输出
try { ByteArrayOutputStream os = new ByteArrayOutputStream(); workBook.write(os); bytes = os.toByteArray(); os.close(); } catch (IOException e) { return null; }
try { downloadFileName = "aps-mch-cls" + "-" + sdf.format(startDate) + "-" + sdf.format(endDate) + ".xlsx"; String[] titles = { "结算编号", "商户编号", "商户名称","结算净额(元)","银行名称","账户类别","户名","账号","结果" }; //response.setHeader("Content-Disposition", "attachment;filename="+fileName); byte[] bytes = mechSettlementQueryAppService.exportToExcel(titles, clearSettleSearch); inputStream = new ByteArrayInputStream(bytes); } catch (Exception e) { e.printStackTrace(); }
测试的时候,导出的数据都是完整的,就是每一行每一列都是有数据的,没有考虑其他情况,所以当发布到生产环境上的时候,数据库的数据不完整,也就是说不是每一行每一列都有数据,这时候就出现了一个问题,就是Can not find a java.io.InputStream with the name [inputStream] in the invocation stack。
查看下官方源码:
if (inputStream == null) { // Find the inputstream from the invocation variable stack inputStream = (InputStream) invocation.getStack().findValue(conditionalParse(inputName, invocation)); } if (inputStream == null) { String msg = ("Can not find a java.io.InputStream with the name [" + inputName + "] in the invocation stack. " + Check the <param name=\"inputName\"> tag specified for this action."); LOG.error(msg); throw new IllegalArgumentException(msg); }
当inputStream有null的时候就会抛出异常。
所以我在设置有可能为空的 cell的时候做了判空处理,将null 设置为""字符,这样就不会出现异常了。
阅读全文
0 0
- Can not find a java.io.InputStream with the name [inputStream] in the invocation stack问题解决
- Can not find a java.io.InputStream with the name [inputStream] in the invocation stack问题解决
- Can not find a java.io.InputStream with the name [inputStream] in the invocation stack
- Can not find a java.io.InputStream with the name [inputStream] in the invocation stack
- Can not find a java.io.InputStream with the name [downloadFile] in the invocation stack问题解决
- Can not find a java.io.InputStream with the name [downloadFile] in the invocation stack问题解决
- Can not find a java.io.InputStream with the name [downloadFile] in the invocation stack问题解决
- Can not find a java.io.InputStream with the name [] in the invocation stack 解决办法
- Can not find a java.io.InputStream with the name [downloadFile] in the invocation stack问题解决
- Can not find a java.io.InputStream with the name [...] in the invocation stack. ...
- Can not find a java.io.InputStream with the name [downloadFile] in the invocation stack.
- Can not find a java.io.InputStream with the name [targetFile] in the invocation stack.
- Can not find a java.io.InputStream with the name [inputStream] in the invocation stack. Check the <
- Can not find a java.io.InputStream with the name [inputStream] in the invocation stack. Check the <p
- 文件下载Can not find a java.io.InputStream with the name [inputStream] in the invocation stack错误
- (Struts2文件下载)Can not find a java.io.InputStream with the name [inputStream] in the invocation stack
- (文件下载)Can not find a java.io.InputStream with the name [inputStream] in the invocation stack
- 文件下载Can not find a java.io.InputStream with the name [inputStream] in the invocation stack错误
- 运维旧网站,ASPCMS太长字符串截断显示。CSS设置换行
- Android 4G模块调试总结
- python __call__ 函数
- SD-WAN 到底是什么?
- 加多芬科技—支付宝蚂蚁金服"春雨计划"执行方案
- Can not find a java.io.InputStream with the name [inputStream] in the invocation stack
- ubuntu下解压缩zip,tar,tar.gz,tar.bz2
- WPF 初学体验-Binding
- Android中Menu的基本用法
- windows修改tomcat运行JDK版本
- 消息转发机制与Aspects源码解析
- h5新特性:<style scoped>
- PHP安全编程:文件包含的代码注入攻击
- 机器学习(二十一)——Optimizer, 单分类SVM&多分类SVM, 时间序列分析