尝试将文件添加到JSP时java.io.FileNotFoundException

时间:2015-06-16 14:25:40

标签: jsp

尝试在JSP代码中添加文件时,我收到以下异常:

  

java.io.FileNotFoundException:/home/harish12/public_html/\uploads\16062015071419Darjeeling.jpg(Permission denied)

我做错了什么?

完整的错误日志如下:

HTTP Status 500 - java.io.FileNotFoundException: /home/harish12/public_html/\uploads\16062015071419Darjeeling.jpg (Permission denied)

type Exception report

message java.io.FileNotFoundException: /home/harish12/public_html/\uploads\16062015071419Darjeeling.jpg (Permission denied)

description The server encountered an internal error that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: java.io.FileNotFoundException: /home/harish12/public_html/\uploads\16062015071419Darjeeling.jpg (Permission denied)
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:549)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:460)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
root cause

java.io.FileNotFoundException: /home/harish12/public_html/\uploads\16062015071419Darjeeling.jpg (Permission denied)
    java.io.FileOutputStream.open(Native Method)
    java.io.FileOutputStream.<init>(FileOutputStream.java:221)
    java.io.FileOutputStream.<init>(FileOutputStream.java:171)
    org.apache.commons.fileupload.disk.DiskFileItem.write(DiskFileItem.java:417)
    org.apache.jsp.addattractions_jsp._jspService(addattractions_jsp.java:324)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.42 logs.

1 个答案:

答案 0 :(得分:2)

它清楚地告诉你出了什么问题:

/home/harish12/public_html**/\**uploads\16062015071419Darjeeling.jpg (Permission denied) 

这些/ \不是文件路径的一部分

相关问题