The error "can not find a java. Io. inputstream with the name" occurs during struts2 file download.

Source: Internet
Author: User

 

The error "can not find a java. Io. inputstream with the name" occurs during struts2 file download.
Javaapacheservlet

The following error occurs when you download a file using struts2 today:

 

Java code
  1. Servlet. Service () for servlet default threw exception
  2. Java. lang. illegalargumentexception: can not find a java. io. inputstream with the name [imagestream] in the invocation stack. check the <Param name = "inputname"> tag specified for this action.
  3. At org. Apache. struts2.dispatcher. streamresult. doexecute (streamresult. Java: 189)
  4. At org.apache.struts2.dispatcher.strutsresultsuppsupp.exe cute (strutsresultsupport. Java: 178)
  5. At com.opensymphony.xwork2.defaactionactioninvocation.exe cuteresult (defaultactioninvocation. Java: 348)
  6. At com. opensymphony. xwork2.defaactionactioninvocation. Invoke (defaactionactioninvocation. Java: 253)
  7. At com. Best. Top. Validate. topinterceptor. Intercept (topinterceptor. Java: 47)
  8. At com. opensymphony. xwork2.defaultactioninvocation $2. doprofiling (defaultactioninvocation. Java: 224)
  9. At com. opensymphony. xwork2.defaultactioninvocation $2. doprofiling (defaultactioninvocation. Java: 223)
  10. At com. opensymphony. xwork2.util. Profiling. utiltimerstack. Profile (utiltimerstack. Java: 455)
  11. At com. opensymphony. xwork2.defaactionactioninvocation. Invoke (defaactionactioninvocation. Java: 221)
  12. At org.apache.struts2.impl.strutsactionproxy.exe cute (strutsactionproxy. Java: 50)
  13. At org. Apache. struts2.dispatcher. Dispatcher. serviceaction (dispatcher. Java: 504)
  14. At org. Apache. struts2.dispatcher. filterdispatcher. dofilter (filterdispatcher. Java: 419)
Servlet. service () for servlet default threw exceptionjava. lang. illegalargumentexception: can not find a java. io. inputstream with the name [imagestream] 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.exe cute (strutsresultsupport. java: 178) at com.opensymphony.xwork2.defaactionactioninvocation.exe cuteresult (defaultactioninvocation. java: 348) at com. opensymphony. xwork2.defaactionactioninvocation. invoke (defaactionactioninvocation. java: 253) at com. best. top. validate. topinterceptor. intercept (topinterceptor. java: 47) at com. opensymphony. xwork2.defaactionactioninvocation $2. doprofiling (defaactionactioninvocation. java: 224) at com. opensymphony. xwork2.defaactionactioninvocation $2. doprofiling (defaactionactioninvocation. java: 223) at com. opensymphony. xwork2.util. profiling. utiltimerstack. profile (utiltimerstack. java: 455) at com. opensymphony. xwork2.defaactionactioninvocation. invoke (defaactionactioninvocation. java: 221) at org.apache.struts2.impl.strutsactionproxy.exe cute (strutsactionproxy. java: 50) at Org. apache. struts2.dispatcher. dispatcher. serviceaction (dispatcher. java: 504) at Org. apache. struts2.dispatcher. filterdispatcher. dofilter (filterdispatcher. java: 419)

 

To tell the truth, this prompt is really misleading. At first, I thought it was a wrong name. It is estimated that most people think like this when they see this prompt. Then, check the source code of streamresult to find that the inputstream is null, and sweat. Check the source code:

 

Java code
  1. If (inputstream = NULL ){
  2. // Find the inputstream from the invocation variable Stack
  3. Inputstream = (inputstream) Invocation. getstack (). findvalue (conditionalparse (inputname, invocation ));
  4. }
  5. If (inputstream = NULL ){
  6. String MSG = ("can not find a java. Io. inputstream with the name [" + inputname + "] in the invocation stack." +
  7. "Check the <Param name = \" inputname \ "> tag specified for this action .");
  8. Log. Error (MSG );
  9. Throw new illegalargumentexception (MSG );
  10. }

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.