FileNotFoundExeception引发的问题

出现的报错方式

java.io.FileNotFoundException: class path resource [D:/workspaces-test/ihrm_parent/ihrm_system/src/main/resources/test.xlsx] cannot be resolved to URL because it does not exist

代码

      Resource resource = new ClassPathResource("D:\\workspaces-test\\ihrm_parent\\ihrm_system\\src\\main\\resources\\test.xlsx");FileInputStream fis = new FileInputStream(resource.getFile());

出现了问题


路径一直找不到

写法错误

 //2.加载模板:模板文件Resource resource = new ClassPathResource("excel-template/hr-demo.xlsx");FileInputStream fis = new FileInputStream(resource.getFile());

这段代码只会查找在resources下的文件,并不会去找真实文件的路径

java.io.FileNotFoundException: class path resource引发的问题相关推荐

  1. java.io.FileNotFoundException: class path resource [com/wisely/highlight_spring4/ch2/aware/text.txt]

    maven+spring在加载配置文件时报错: java.io.FileNotFoundException: class path resource [com/wisely/highlight_spr ...

  2. Caused by: java.io.FileNotFoundException: class path resource [applicationContext.xml] cannot be ope

    1.错误描述 java.lang.IllegalStateException: Failed to load ApplicationContextat org.springframework.test ...

  3. 解决java.io.FileNotFoundException: class path resource [beans.xml] cannot be opened because it does no

    解决java.io.FileNotFoundException: class path resource [beans.xml] cannot be opened because it does no ...

  4. 问题备忘: 将工程打包成jar包运行,就报java.io.FileNotFoundException: class path resource错误

    最近在在使用@Value注入文件碰到如下问题: 工程在在IntelliJ IDEA开发环境里正常运行,但是一旦将工程打包成jar包运行,就报java.io.FileNotFoundException: ...

  5. java.io.FileNotFoundException: class path resource异常处理

    java.io.FileNotFoundException: class path resource异常处理找不到什么xml啊,什么@Auto....注解不能用啊,什么鬼啊.如果你已经百度了半天还是没 ...

  6. nested exception is java.io.FileNotFoundException: class path resource [springmvc.xml] cannot be ope

    根据 提示 ,逐步解决bug,逐层推进:比如,有一个错是IOException异常,Springmvc.xml找不到,就需要去找下是否有配置文件,如果有,怎么回事?第二次再深入发现是target下没有 ...

  7. java.io.FileNotFoundException: class path resource [springmvc.xml] cannot be opened

    一般来说路径问题. 我检查了web.xml的行,发现我设置的是固定的springmvc,但我实际命名为springMVC,当然报错. 其实报错了通过耐心翻译很容易看出问题,path resource ...

  8. Causes for java.io.FileNotFoundException: class path resource [hibernat.xml] cannot be opened becaus

    新手在做Spring和Hibernate的整合,我的Spring的配置文件是这么写的: <?xml version="1.0" encoding="UTF-8&qu ...

  9. maven异常解决 java.io.FileNotFoundException: class path resource [applicationContext_*.xml]

    经过查阅得知 出现这种FIleNotFoundException 原因无非两点: 1.路径配置错误 2.编译有问题,文件不存在 具体方法解决请参考https://blog.csdn.net/hanxu ...

最新文章

  1. python语言中一切皆对象_2 python 中一切皆对象
  2. ph值图片_螃蟹养殖大数据——高温季节的pH值过高,不适宜养殖螃蟹?未必
  3. c3p0 参数 模糊查询_MySQL模糊查询用法大全(正则、通配符、内置函数等)
  4. SAP云平台开启Kyma功能时发送到后台的HTTP请求
  5. UDP协议下的DatagramSocket和DatagramPacket
  6. Bailian2915 字符串排序【排序】
  7. B-数,B+树,B*树简单定义
  8. ie以及ie内核浏览器连不上网,其他浏览器可以,部分软件连不上网的解决办法
  9. Silverlight 4 Tools for Visual Studio 2010手动一步一步安装
  10. 01. Couchbase简介-CouchBase从0到50
  11. visual c++ build tools下载地址
  12. HTML链接和锚点学习---第四天
  13. 2022 年最新博客专家申请流程
  14. Oracle数据库:排序order by语句,select from where order by的执行先后顺序,各种样例
  15. 关于安卓视频加水印与剪辑功能实现
  16. 数据分析_python数据可视化(基于matplotlib+pandas)
  17. 数字电路要点总结-TTL电路分析
  18. iPhone12与mate40,你pick哪一款?
  19. 广州市政务服务中心_【广州市政务服务中心】广州市政务服务中心电话,广州市政务服务中心地址_图吧地图...
  20. php解析m3u8代码,PHP解码转发M3U8 PHP读取转发M3U8的方法

热门文章

  1. window定时计划任务-定时重启服务/软件
  2. unity||控制代码执行的时间
  3. [cs231n] Softmax Classifier/ SVM
  4. 机器学习所需要的数学基础知识---矩阵(1)
  5. 【python爬虫】爬取网站数据,整理三句半语料数据集
  6. 海康威视 NET_DVR_Login_V30 错误代码说明总结 (后补充所有故障对应码)
  7. APISpace 成语大全API
  8. 【重磅推荐】嵌入式Linux经典书单(部分含视频)
  9. 做青年领袖必须具备哪些素质?
  10. uniapp真机调试不了?