(Struts2文件下载)Can not find a java.io.InputStream with the name [inputStream] in the invocation stack

金蝶云星空初级实施认证考题 Q4.[单选题] (1.5分) 总账中的多账簿账表主要是基于什么进行查看的Q47.[多选题] (2.5分) 销售订单的收款计划页签勾选预收之后,预收控制环节可以控制哪些节点? 阅读详情
转载自  kaisep
最终编辑  yeyeok

2010-1-22 9:45:03 org.apache.struts2.dispatcher.StreamResult doExecute
严重: Can not find a java.io.InputStream with the name [inputStream] in the invocation stack. Check the <param name="inputName"> tag specified for this action.
2010-1-22 9:45:03 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet default threw exception
java.lang.IllegalArgumentException: Can not find a java.io.InputStream with the name [inputStream] in the invocation stack. Check the <param name="inputName"> tag specified for this action.
at org.apache.struts2.dispatcher.StreamResult.doExecute(StreamResult.java:189)
at org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:178)
at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:348)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:253)
at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:221)

==========================解决办法===========================
这个错误报的真有点误导人呀,我还一直以为我struts.xml中<param name="inputName">inputStream</param>和action中的方法名getInputStream()不一致的问题,大家如果也碰到此类问题,直接打印
InputStream in=ServletActionContext.getServletContext().getResourceAsStream(realPath);
System.out.println(in);

如果打印为NULL的话,恭喜您,问题得以解决,问题的原因是这个流的realPath路径错误,像我的,
//  String realPath=ServletActionContext.getServletContext().getRealPath("/uploadImages")+ "/"+name; 路径错误

   String realPath="/uploadImages/"+name;正确的
=====================================================
没明白的,请看下面的详细说来
怪呀,我的配置应该没错呀
页面上:
<a href="fileDownload.action?fileName=<s:property value ="imageName" />">下载此图片</a>
struts.xml中
----------------------------------------------------------
<!-- 文件下载,支持中文附件名 -->
   <action name="fileDownload"
    class="com.test.action.filedown.FileDownloadAction">
    <result name="success" type="stream">
     <!-- 动态文件下载的,事先并不知道未来的文件类型,那么我们可以把它的值设置成为:application/octet-stream;charset=ISO8859-1 ,注意一定要加入charset,否则某些时候会导致下载的文件出错; -->
     <param name="contentType">
     application/octet-stream;charset=ISO8859-1
     </param>
     <param name="contentDisposition">
      attachment;filename="${downloadFileName}"
     </param>
     <!-- 使用经过转码的文件名作为下载文件名,downloadFileName属性
      对应action类中的方法 getDownloadFileName() 其中特殊的代码就是${downloadFileName},它的效果相当于运行的时候将action对象的属性的取值动态的填充在${}中间的部分,我们可以认为它等价于+action. getDownloadFileName()。 -->
     <param name="inputName">inputStream</param>
     <param name="bufferSize">4096</param>
    </result>
   </action>
----------------------------------------------------------
action中
----------------------------------------------------------
private String fileName;// 初始的通过param指定的文件名属性 set get

/** 文件名 转换编码 防止中文乱码*/
public String getDownloadFileName() {
   String fileName=ServletActionContext.getRequest().getParameter("fileName");
   String downFileName = fileName;
   try {
    downFileName = new String(downFileName.getBytes(), "ISO8859-1");
   } catch (Exception e) {
    e.printStackTrace();
   }
   return downFileName;
}
//下载的流
public InputStream getInputStream() {
   String name=this.getDownloadFileName();
//  String realPath=ServletActionContext.getServletContext().getRealPath("/uploadImages")+ "/"+name; 路径错误
   String realPath="/uploadImages/"+name;
   InputStream in=ServletActionContext.getServletContext().getResourceAsStream(realPath);
   if(null==in){
    System.out.println("Can not find a java.io.InputStream with the name [inputStream] in the invocation stack. Check the <param name=\"inputName\"> tag specified for this action.检查action中文件下载路径是否正确.");   
   }
   return ServletActionContext.getServletContext().getResourceAsStream(realPath);
}

@Override
public String execute() throws Exception {
   return SUCCESS;
}

系统分析师论文范文(三)微服务 摘要(300字) 2024年4月,我作为系统分析师参与某省三甲医院云影像系统建设项目,负责系统分析与设计工作。该项目旨在响应国家"无胶片化"医疗政策,解决传统影像系统数据孤岛、调阅效率低等问题。系统基于DICOM 3.0和HL7国际标准,采用B/S架构与Spring Cloud Alibaba微服务技术栈,包含影像采集、智能分析、数据安全等核心模块,实现全院影像资源的云端统一管理与多端调阅。在架构设计上,通过微服务拆分、分布式事务控制及多层次安全防护机制,保障了系统的高可用性与数据一致性。系统于2024年1 阅读详情

相关推荐

USB3.0一致性测试方案

为各测试项目具体测试结果包括脉冲串突发时间、脉冲串重复时间、时钟周期以及眼图等完整USB3.0测试项目,工程师可以看到各项测试的具体结果方便观察。RIGOL 提供了一套完善的工具,包括数字示波器、专业的测试夹具以及全自动一致性测试软件,使得USB 3.0设备设计人员能够高效精确地进行信号捕捉、测试与分析。报告第二部分测试摘要,在此可以看到USB3.0测试所有测试项目,并且可以观看到测试是否正常,可以帮助工程师更好的判断测试结果。,以简化下载、存储以及对于多媒体的大量内容的共享。

2409_87378937的博客 2527

Can not find a java.io.InputStream with the name [inputStream] in the invocation stack. Check the

关于stuts的下载文件问题 具体异常: Cannotfindajava.io.InputStreamwiththename[inputStream]intheinvocationstack.Checkthe<paramname="inputName">tagspecifiedforthisaction. 就是这个问题,从一点多纠结了,几...

zhupengqq的博客 996

ROS2 Nav2实战:解决rviz2显示no map received的3种实用方法(附详细步骤)

本文针对ROS2 Nav2导航栈中rviz2显示“no map received”的常见问题,提供了三种核心解决方案。深入剖析了问题根源在于ROS2生命周期节点管理、QoS策略不匹配及坐标系设置错误,并分别通过手动配置流程、集成生命周期管理器以及调优QoS策略与固化rviz2配置,给出了详细的实战步骤,确保地图数据可靠显示。

j0k1l2m3n的博客 422

Can not find a java.io.InputStream with the name [inputStream] in the invocation stack问题解决

原文地址: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问题解决作者:digense具体异常是这句

dongfangbubai1的专栏 1507

2025年情感分析(SA)综述——论文阅读报告

2025年情感分析(SA)综述——论文阅读报告

Samdy_L的博客 2086

别再用Excel硬算传热了!用MATLAB/Octave复现国赛数学建模A题(附完整代码与避坑指南)

本文详细介绍了如何利用MATLAB/Octave高效解决数学建模中的传热问题,替代传统的Excel计算方法。通过复现2018年国赛A题的高温作业服传热模型,从理论推导到代码实现,提供了完整的有限差分法解决方案和参数拟合技巧,帮助读者提升数学建模效率和准确性。

weixin_30512965的博客 379

strut2下载文件的“ <param name="inputName"> tag specified for this action.”异常

具体异常是这句话:Can not find a java.io.InputStream with the name [inputStream] in the invocation stack. Check the tag specified for this action. 1.文件路径不对,根本就没有取到文件。这种情况下,可以将获得InputStream的那条语句放在system.out

a243932069的专栏 9538

2023年五一数学建模 | 第二十届五一数学建模C题:“双碳”目标下低碳建筑研究

2023年五一数学建模 | 第二十届五一数学建模C题:“双碳”目标下低碳建筑研究

前程算法屋的博客 1377

Can not find a java.io.InputStream with the name [inputStream] in the invocation

java.lang.IllegalArgumentException: Can not find a java.io.InputStream with the name [inputStream] in the invocation stack. 其实就是因为路径不对引起的。下载只能是相对路径,不要弄上硬盘的路径,这样就肯定抛这个异常啦。不要犯类似的错误了。 //从下载...

wjt276的专栏 290

会话管理技巧——如何优化OpenClaw的上下文理解能力(2026进阶版)

本文深入探讨了OpenClaw系统的会话管理技术,重点介绍了会话定义、生命周期管理和上下文优化策略。会话管理包含会话ID、用户信息、状态等核心要素,以及创建、维护、终止和恢复四个生命周期阶段。上下文管理通过ContextManager类实现,支持创建、更新、消息添加和变量管理等功能,并采用历史记录机制确保会话连续性。ContextOptimizer类则负责应用优化规则,通过消息和变量压缩等技术提升系统性能。这些技术共同构建了OpenClaw强大的会话管理能力,为AI助手提供了高质量的交互体验基础。

博客 490

2023年高教社杯 | 2023年高教社杯全国大学生数学建模思路(A题思路、C题思路)

2023年高教社杯 | 2023年高教社杯全国大学生数学建模思路(A题思路、C题思路)

前程算法屋的博客 624

struts2文件下载出现Can not find a java.io.InputStream with the name [imageStream] in the invocation stack.

struts2就行文件下载时出现如下错误: Servlet.service() for servlet default threw exception   java.lang.IllegalArgumentException: Can not find a java.io.InputStream with the name [imageStream] in the invocation st

xiaobiaobiao521的专栏 1682

Sigrity OptimizePI Best Capacitor Location Estimation模式如何评估电容最佳位置操作指导

Sigrity OptimizePI Best Capacitor Location Estimation模式用于前仿真分析,评估电容的最佳位置以获得最小回路电感,如何分析,以下图为例进行说明。IC devices,输入U*, A*, B*, Q*, P*,将所有这些字母开头的器件都识别为IC。Min设置为1(最少电容个数为1),max设置为28(最多电容个数为28)Capacitors 输入C*,将所有C开头的器件都识别为电容。Grid X设置为8,Grid Y也设置为8。

weixin_54787054的博客 382

struts2文件的下载,Can not find a java.io.InputStream with the name [inputStream] in the invocation stack....

Struts Problem Report Struts has detected an unhandled exception: Messages: Can not find a java.io.InputStream with the name [inputStream] in the invocation stack. Check the tag specifi...

weixin_30553065的博客 131

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

struts文件下载 Can not find a java.io.InputStream with the name [downLoad] in the invocation stack与乱码问题

在做一个使用struts做一个文件下载的操作时,先后遇到了两个问题。 首先是遇到了Can not find a java.io.InputStream with the name [downLoad] in the invocation stack.Check the <param name="inputName"> tag specified for this action.这个异...

Cheang_Bokgaai的博客 629

efm32 入门.pdf

本PDF共计22页,介绍的是操作驱动API,下载与否自己斟酌。

Can not find a java.io.InputStream with the name [downloadFile] in the invocation stack.

1、错误描述八月 14, 2015 4:22:45 下午 com.opensymphony.xwork2.util.logging.jdk.JdkLogger error 严重: Exception occurred during processing request: Can not find a java.io.InputStream with the name [downloadFile]

游海东的技术专栏 5745

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

(文件下载)Can not find a java.io.InputStream with the name [inputStream] in the invocation stack

2010-1-22 9:45:03 org.apache.struts2.dispatcher.StreamResult doExecute 严重: Can not find a java.io.InputStream with the name [inputStream] in the invocation stack. Check the tag specified for this ac

l345480242的专栏 1183

Can not find a java.io.InputStream with the name [inputStream] in the invocation stack

今天实现Excel导出功能,结果总是提示下面的错误: 18:32:04,793 ERROR StreamResult:23 - Can not find a java.io.InputStream with the name [inputStream] in the invocation stack. Check the tag specified for this action. 看下源码

Developer of XingKong22star 2470

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. Check the tag specified for this action. 据说可能是以下两种方法导致: 1.文件路径不对,根本就没有取到文件。这种情况下,可以将获得InputStrea

u010017937的专栏 486

Can not find a java.io.InputStream with the name [inputStream] in the invocation stack. Check the <

最近项目需要用到上传下载,以前学jsp的时候直接用的是smartUpload,现在学的框架但是老师只是简单地教了框架的内容 对struts文件上传和下载没有涉及,没办法只能自己自学了!结果出现了上面的问题。 这个问题的根本原因网上都有说出来,但是没有给出的解决方案。原因是要返回的流为空,文件的路径有误导致文件的输入流为空! 所以最好在逻辑处理那块输出的你要下载文件的路径看是不是你要下载的路径

一身都是月 1978

Can not find a java.io.InputStream with the name [...] in the invocation stack. ...

3379748 [qtp33117621-12] ERROR org.apache.struts2.dispatcher.StreamResult - Can not find a java.io.InputStream with the name [joGroupMembers] in the invocation stack. Check the tag specified for this

逍遥子曰: 2568

struts2文件下载出现Can not find a java.io.InputStream with the name的错误

今天在用struts2就行文件下载时出现如下错误: Servlet.service() for servlet default threw exception   java.lang.IllegalArgumentException: Can not find a java.io.InputStream with the name [imageStream] in the invocatio

chenqqabcdchenqqabcd的专栏 807

Struts2 下载 Can not find a java.io.InputStream with the name [downloadFile] in the invocation stack

1、检查"后面属性的那个get方法.  去get  后面第一个字母小写  2、资源路径 不能用虚拟路径  自己手写。

happyandyo的博客 411
上一篇: java学习笔记(线程池)
下一篇: ExtJs学习笔记(XTemplate的使用)
Peditable
博客等级 码龄16年 11粉丝 47原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值