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

Posted teayear

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了nested exception is java.io.FileNotFoundException: class path resource [springmvc.xml] cannot be ope相关的知识,希望对你有一定的参考价值。

根据 提示 ,逐步解决bug,逐层推进;比如,有一个错是IOException异常,Springmvc.xml找不到,就需要去找下是否有配置文件,如果有,怎么回事?第二次再深入发现是target下没有,;这时候,我们再深入,如何把spring.xml生成到target下。发现可以配置pom.xml的build下的resources设置,基本解决到这一步都可以完成。如果还么有完成继续查:设置了resources,没有解决生成问题:发现pom.xml的packing生成方式错了是pom方式,改成war方式即可。

报错:IOException parsing XML document from class path resource [springmvc.xml]; nested exception is…

原因:resouces下的xml文件无法编译到target/classes下【即xml文件不在src下】
因为Idea新版本开始只支持外部编译,因此需要在pom.xml文件手动指定资源文件的目录。在Maven中添加了以下配置之后,资源目录src/main/java/resources下面的配置文件也就copy过去了,所以再次运行代码的时候就ok了。

有该配置信息。

pom文件中核对
发现是pom 打包方式,改成jar或者war。成功编译xml文件进target

以上是关于nested exception is java.io.FileNotFoundException: class path resource [springmvc.xml] cannot be ope的主要内容,如果未能解决你的问题,请参考以下文章

nested exception is java.lang.IncompatibleClassChangeError: Implementing class(已解决)

nested exception is java sql SQLException IO 错误

Spring BeanDefinitionStoreExcept-nested exception is java.lang.ArrayIndexOutOfBoundsException: 53804

spring data jpa启动报错:nested exception is java.util.NoSuchElementException

HTTP Status 500 - Request processing failed; nested exception is java.lang.IllegalArgumentException:

Failed to start bean ‘documentationPluginsBootstrapper‘; nested exception is java.lang.NullPointerEx