下载文件或图片出错,显示Can not find a java.io.InputStream with the name [inputStream] in the invocation

    xiaoxiao2021-03-25  147

    使用ServletActionContext.getServletContext().getResourceAsStream(inputPath); 下载文件时候报

    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]

    我的原因是InputStream的外部包引错了,检测一下,正确的应该是import java.io.InputStream;

    根据网上的结果不外乎四个原因:(1)路径不对 ,不需要写完整路径的

                                                          (2)文件不存在

                                                          (3)文件名是中文的  

                                                           (4)包引入错了,我把import org.omg.CORBA.portable.InputStream引入了,正确应该是import java.io.InputStream;

    转载请注明原文地址: https://ju.6miu.com/read-5854.html

    最新回复(0)