博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
SpringBoot 异常 java.io.FileNotFoundException: class path resource [com/sxw/springbootproducer/mappin
阅读量:4112 次
发布时间:2019-05-25

本文共 1904 字,大约阅读时间需要 6 分钟。

2019-11-08 17:23:24.446 ERROR 215864 --- [           main] o.s.boot.SpringApplication               : Application run failedorg.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'rabbitOrderSender': Unsatisfied dependency expressed through field 'brokerMessageLogMapper'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'brokerMessageLogMapper' defined in file [E:\学习\java\项目学习\springboot-rabbitmq\springboot-producer\target\classes\com\sxw\springbootproducer\mapper\BrokerMessageLogMapper.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/sxw/springbootproducer/config/database/MybatisDataSourceConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactoryBean' threw exception; nested exception is java.lang.RuntimeException: java.io.FileNotFoundException: class path resource [com/sxw/springbootproducer/mapping/] cannot be resolved to URL because it does not exist

 

问题: 找不到URL指定的文件

出错位置:

这个位置找不到URL对应的文件

进一步分析,通过 

得到解决办法:

报 xml找不到。可在:springboot-produce.pom 文件内添加如下代码:    
src/main/resources
src/main/java
**/*.properties
**/*.xml
false

为什么这么做可以? 

先看rescources 标签的作用 

从而得到错误原因:

由于没有配置resources 所以不会打包该路径下的文件到classpath, 然后就没有mapping这个文件夹,所以dataSource找不到URL,就报错。

 

 

 

 

 

转载地址:http://orqsi.baihongyu.com/

你可能感兴趣的文章
LeetCode第47题思悟—— 全排列 II(permutations-ii)
查看>>
LeetCode第48题思悟——旋转图像(rotate-image)
查看>>
驱动力3.0,动力全开~
查看>>
记CSDN访问量10万+
查看>>
Linux下Oracle数据库账户被锁:the account is locked问题的解决
查看>>
极客算法训练营学习笔记(一)
查看>>
记CSDN访问20万+
查看>>
Windows 环境下Webstorm 2020.3 版本在右下角找不到Git分支切换部件的一种解决方法
查看>>
Electron-Vue项目中遇到fs.rm is not a function问题的解决过程
查看>>
飞机换乘次数最少问题的两种解决方案
查看>>
有向无回路图的理解
查看>>
设计模式中英文汇总分类
查看>>
MFC实现五子棋游戏
查看>>
WPF实现蜘蛛纸牌游戏
查看>>
单例模式
查看>>
工厂方法模式
查看>>
模板方法模式
查看>>
数据结构之队列、栈
查看>>
数据结构之树
查看>>
数据结构之二叉树
查看>>