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

简介: 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

目录
相关文章
|
1月前
Could not open ServletContext resource [/WEB-INF/springmvc-servlet.xml]【解决方案】
Could not open ServletContext resource [/WEB-INF/springmvc-servlet.xml]【解决方案】
16 0
java.lang.Error: Unresolved compilation problem: The type List is not generic; it cannot be parame
java.lang.Error: Unresolved compilation problem: The type List is not generic; it cannot be parame
|
1月前
|
网络安全
ssh报错java.lang.ClassCastException: com.sun.proxy.$Proxy6 cannot be cast to org.service.impl.EmpServi
ssh报错java.lang.ClassCastException: com.sun.proxy.$Proxy6 cannot be cast to org.service.impl.EmpServi
10 1
|
1月前
|
NoSQL Java Redis
【问题篇】解决Unable to connect to Redis; nested exception is io.lettuce.core.RedisConnectionException
【问题篇】解决Unable to connect to Redis; nested exception is io.lettuce.core.RedisConnectionException
331 0
|
4月前
|
Java
【Java报错】java.lang.ClassCastException: xxxClass cannot be cast to java.lang.Comparable 问题重现+解决
【Java报错】java.lang.ClassCastException: xxxClass cannot be cast to java.lang.Comparable 问题重现+解决
45 0
|
6天前
|
XML 数据格式
小米备份descript.xml文件
小米备份descript.xml文件
12 0
|
18天前
|
XML Java 数据库连接
mybatis中在xml文件中通用查询结果列如何使用
mybatis中在xml文件中通用查询结果列如何使用
20 0
|
19天前
|
XML JavaScript 前端开发
xml文件使用及解析
xml文件使用及解析
|
1月前
|
XML C# 数据格式
使用C#操作XML文件
使用C#操作XML文件
11 0
|
1月前
|
Java
java实现遍历树形菜单方法——映射文件VoteTree.hbm.xml
java实现遍历树形菜单方法——映射文件VoteTree.hbm.xml
10 0