在netbeans java web app项目中将图像存储到mysql数据库时,filenotfound异常

在netbeans java web app项目中将图像存储到mysql数据库时,filenotfound异常,java,mysql,tomcat,netbeans-7,Java,Mysql,Tomcat,Netbeans 7,StackTrace:正在尝试从以下文件中读取:C:\Program Files\Apache Software Foundation\Apache Tomcat 7.0.14\bin\images\img1g.png 虽然imgage位置是:“MyProject/web/images”但您使用的是绝对文件路径。您是否尝试删除前缀/?我们需要知道这个实际的类文件存在于哪里?它试图从C:\Program Files\Apache Software Foundation\Apache Tomcat

StackTrace:正在尝试从以下文件中读取:C:\Program Files\Apache Software Foundation\Apache Tomcat 7.0.14\bin\images\img1g.png


虽然imgage位置是:“MyProject/web/images”

但您使用的是绝对文件路径。您是否尝试删除前缀
/
?我们需要知道这个实际的类文件存在于哪里?它试图从C:\Program Files\Apache Software Foundation\Apache Tomcat 7.0.14\bin\images\img1g.png读取该文件
  File filePath = new File("/images/img1g.png");
     System.out.println("Attempting to read from file in: "+filePath.getCanonicalPath());FileInputStream ins=new FileInputStream(filePath);