前提:idea  maven  ssm

错误信息如下:

严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [spring/sprint-tx.xml]; nested exception is java.io.FileNotFoundException: class path resource [spring/sprint-tx.xml] cannot be opened because it does not exist
...省略
Caused by: java.io.FileNotFoundException: class path resource [spring/sprint-tx.xml] cannot be opened because it does not exist
at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:172)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:330)
... 21 more

一直报 class path resource [spring/sprint-tx.xml]不存在!而且resource目录的文件加载不到target目录下的classes文件夹里

文件位置如下:

pom.xml文件配置了对resource文件 过滤

<!--配置Maven 对resource文件 过滤 -->
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>*</include>
<include>*/*</include>
</includes>
<filtering>true</filtering>
</resource>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>

排查了好久,在网上也见其他人也出现了同种情况--》虽然配置了resources过滤,但是就是加载不到classes里面

、、、

直到又一次的排查中,瞄到了创建的目录,resource   ???  不是 resources

idea的maven项目默认的加载目录是 resources, pom.xml配置的也是<directory>src/main/resources</directory>

记录此次粗心造成的麻烦!

idea的maven项目运行出错_java.io.FileNotFoundException: class path resource [spring/sprint-tx.xml] cannot be opened because it does not exist的更多相关文章

  1. 解决CXF的java.io.FileNotFoundException: class path resource [META-INF/cxf/cxf-extension-soap.xml] cannot be opened because it does not exist

    以下是错误信息 九月 25, 2017 8:22:04 下午 org.springframework.web.context.support.XmlWebApplicationContext prep ...

  2. java.io.FileNotFoundException: class path resource [META-INF/xfire/services.xml] cannot be opened because it does not exist

    解决办法: maven创建项目时: META-INF目录下面新建一个xfire文件夹,把services.xml文件放到这个文件夹里,再将整个META-INF拷贝到WEB-INF中 clean一下工程 ...

  3. cxf(3.1.1) 异常Caused by: java.io.FileNotFoundException: class path resource [META-INF/cxf/cxf-extension-soap.xml]

    Caused by: java.io.FileNotFoundException: class path resource [META-INF/cxf/cxf-extension-soap.xml] ...

  4. Caused by: java.io.FileNotFoundException: class path resource [spring/springmvc.xml] cannot be opene

                        Caused by: java.io.FileNotFoundException: class path resource [spring/springmvc. ...

  5. nested exception is java.io.FileNotFoundException: class path resource [spring/spring-datasource-mog

    spring单元測试时发现的问题: org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsin ...

  6. Spring报错:java.io.FileNotFoundException: class path resource [applicationContext.xml] cannot be opened because it does not exist

    感谢:http://blog.chinaunix.net/uid-20681545-id-184633.html提供的解决方案,非常棒 ! 问题说明: 新建一个Spring项目,新建一个Bean类:H ...

  7. Caused by: java.io.FileNotFoundException: class path resource

    异常: java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.test.c ...

  8. parsing XML document from class path resource [config/applicationContext.xml]; nested exception is java.io.FileNotFoundException: class path resource [config/applicationContext.xml] 解决方案

    parsing XML document from class path resource [config/applicationContext.xml]; nested exception is j ...

  9. Caused by: java.io.FileNotFoundException: class path resource [applicationContext.xml] cannot be ope

    1.错误描述 java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.tes ...

随机推荐

  1. jinfo 命令

    NAME jinfo - Generates configuration information. SYNOPSIS jinfo [ option ] pid 示例:jinfo 3245

  2. @click.prevent.self和@click.self.prevent区别

    注意:prevent 阻止的是“跳转事件”而不是“弹出警告” v-on:click.prevent.self的demo如下: <div id="box"> <di ...

  3. 【模板】dijkstra与floyd

    (我永远喜欢floyd) 温馨提示:与SPFA一起食用效果更佳 传送门:https://www.cnblogs.com/Daz-Os0619/p/11388157.html Floyd 大概思路: 对 ...

  4. 虚拟机(Vmware)安装ubuntu18.04和配置调整(三)

    三.ubuntu安装软件     1.安装常用软件 python程序员: $ sudo apt install ipython $ sudo apt install ipython3 $ sudo a ...

  5. VUE前后台分离

    VUE前后台分离 配置js环境 jQuery >: cnpm install jquery vue/cli 3 配置jQuery:在vue.config.js中配置(没有,手动项目根目录下新建) ...

  6. WPF 异步加载窗体

    加载某个界面时,需要获取数据,而数据返回的时间比较长,这个时候可以异步加载界面. 1.在该窗体的加载事件(Load)中编写以下代码: new Thread(p=>{DataBinding();} ...

  7. THUWC2020滚粗记

    \(Day-?\) 教练叫走了3个人,没叫我 感觉药丸,然后被告知pku没过,thu过了 神奇,然后就活了 后来在机房颓废,大声说笑被diss 当时感觉颓的有点过头,药丸 \(Day0\) 跟NC去T ...

  8. 【weixin】微信支付---PC网站微信支付

    一.PC网站支付 微信支付支持完成域名ICP备案的网站接入支付功能.PC网站接入支付后,可以通过JSAPI支付或Native支付,自行开发生成二维码,用户使用微信“扫一扫”来完成支付. 二.支付产品介 ...

  9. 查找和杀掉占用GPU显存的进程

    用只有2个G的显卡跑数据就需要在训练之前先把无关进程杀掉,防止跑到一半显存满了 nvidia-smi:显示当前GPU中的线程 kill -9 PID:输入PID以结束线程

  10. 转:Git和Github简单教程

    转自:https://www.cnblogs.com/schaepher/p/5561193.html Git和Github简单教程   原文链接:Git和Github简单教程 网络上关于Git和Gi ...