标签:src des pom http filter web项目 blog rect ring
前几天好好运行的web项目突然跑不起来了
报这个错误
2019-09-16 19:18:29 [ RMI TCP Connection(3)-127.0.0.1:357 ] - [ ERROR ] Context initialization failed org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [applicationContext.xml]; nested exception is java.io.FileNotFoundException: class path resource [applicationContext.xml] cannot be opened because it does not exist
很显然,是找不到配置文件。
1、先考虑recourse目录下的配置文件路径是否正确。
点击文件名可以跳转,排除这个原因。
2、检查生成的target/classes 文件下是否有配置文件。
这是输出目录的主体,项目实际使用的配置文件就在里面。

没有找到配置文件。
解决办法:在pom.xml中添加下面代码
<build>
<resources>
<resource>
<directory>src/main/recourse</directory>
<includes>
<include>**/*.xml</include>
<include>**/*.properties</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
</build>
<directory></directory>路径根据自己的配置文件的路径而定。
<includes></includes>中的内容根据自己配置文件的种类而定。

成功。
参考博客:
https://blog.csdn.net/moneyshi/article/details/53287036
https://blog.csdn.net/yyym520/article/details/80516103
标签:src des pom http filter web项目 blog rect ring
原文地址:https://www.cnblogs.com/ditf/p/11529719.html