报错信息:
org.springframework.beans.factory.BeanDefinitionStoreException:
IOException parsing XML document from class path resource [spring-mvc.xml];
nested exception is java.io.FileNotFoundException:
class path resource [spring-mvc.xml] cannot be opened because it does not exist
Tomcat 提示 spring-mvc.xml 找不到。
原因:
Maven 没有将 resources 包下的配置文件进行打包,导致运行的时候找不到配置文件。
解决方法:
在 Maven 配置文件的<build> 标签中加入以下代码即可
<resources>
<resource>
<!-- 为了让java文件下的xml文件也能被读取-->
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
<filtering>true</filtering>
</resource>
<resource>
<!-- 为了让resources中的文件也能被读取-->
<directory>src/main/resources</directory>
<includes>
<include>**/*</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
标题:部署SSM项目 提示java.io.FileNotFoundException: class path resource [spring-mvc.xml] cannot be opened because it does not exist异常
作者:Yi-Xing
地址:http://47.94.239.232:10014/articles/2019/09/13/1568344311025.html
博客中若有不恰当的地方,请您一定要告诉我。前路崎岖,望我们可以互相帮助,并肩前行!