Caused by: java.io.FileNotFoundException: class path resource [../../resources/config/spring.xml] cannot be opened because it does not exist
在尝试使用Spring的Test的时候遇到了这个错误
原来的代码:
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={"../../../resources/config/spring.xml"})
public class TestFund { @Autowired
private FundService fundService; @Test
public void testFundSelectAll() {
//System.out.println("所有基金: " + fundService.selectAll());
System.out.println(fundService);
}
}
原因分析:
修改spring的配置文件spring.xml的位置
解决方法:
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:config/spring.xml")
public class TestFund { @Autowired
private FundService fundService; @Test
public void testFundSelectAll() {
//System.out.println("所有基金: " + fundService.selectAll());
System.out.println(fundService);
}
}
问题解决!
Caused by: java.io.FileNotFoundException: class path resource [../../resources/config/spring.xml] cannot be opened because it does not exist的更多相关文章
- 解决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 ...
- 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一下工程 ...
- 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] ...
- 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 ...
- Caused by: java.io.FileNotFoundException: class path resource [spring/springmvc.xml] cannot be opene
Caused by: java.io.FileNotFoundException: class path resource [spring/springmvc. ...
- Caused by: java.io.FileNotFoundException: class path resource
异常: java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.test.c ...
- Caused by: java.io.FileNotFoundException: class path resource [com/cxy/springboot/mapping/] cannot be resolved to URL because it does not exist
java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.test.conte ...
- spring junit class path resource [ /com/config/spring-core.xml] cannot be opened because it does not exist
正确写法应该如下: @RunWith(SpringJUnit4ClassRunner.class) //@ContextConfiguration(locations="classpath: ...
- 启动tomcat报错Caused by: java.io.FileNotFoundException: class path resource [io/renren/controller/NodeDataController] cannot be opened because it does not exist
?? 清理项目,再重启服务就好了.........
随机推荐
- JS-表单非空验证
JavaScript 表单验证 JavaScript 可用来在数据被送往服务器前对 HTML 表单中的这些输入数据进行验证. 实例:1.用户名的非空验证代码如下: <head> <m ...
- Swift 中调试状态下打印日志
首先我们应该知道Swift中真个程序的入口就是在AppDelegate.swift中.所以在打印日志在 AppDelegate.swift中是这样的 import UIKit @UIApplicati ...
- shell 实现war包的配置更新和自动发布
此脚本主要用来实现非maven tomcat项目的war包手动发布, 1.将测试war包上传至指定目录 2.备份目前生产代码 3.自动配置文件替换 4.新版本代码的发布 #!/bin/bash ### ...
- nginx安装https证书
安装证书 文件说明:1. 证书文件xxxxx.pem,包含两段内容,请不要删除任何一段内容.2. 如果是证书系统创建的CSR,还包含:证书私钥文件xxxx.key. ( 1 ) 在Nginx的安装目录 ...
- android中shape的使用(android:angle小解)
本文参考http://kofi1122.blog.51cto.com/2815761/521605和http://blog.csdn.net/qizi329/article/details/63098 ...
- Azure App Service-添加自定义域名和SSL保护
语雀知识库:https://www.yuque.com/seanyu/azure/appservicessl 公众号:云计算实战 案例 添加自定义域并开启SSL保护 进入App Service控制台 ...
- Python笔记_第一篇_面向过程_第一部分_5.Python数据类型之字符串类型(string)
关于Python的字符串处理也如其他语言一样属于重点中的重点,主要是牵扯到的函数和内容较为多和乱一些.关于什么是字符串,Python中的定义是:以单引号或者双引号括起来的任意文本. 1. 字符串的 ...
- uni-app文章详情-富文本展示 优雅展示代码块
在uni-app开发中,开发一个资讯详情页面,详情里包含图片和代码块.这时候用简单的rich-text控件已经不够用了.用官方demo里的html-parser.js也无法很好的展示代码区域.这个时候 ...
- php分页代码。
$result_count=select("hy_news_en",$where,'','','count(1)'); $count=mysql_fetch_array( ...
- 17.3.12--uillib模块
1---uillib是python标准库中最常用的一个python网络应用资源访问的模块,他可以让你像访问文本一样,读取网页的内容 它的作用是访问一些不需要验证的网络资源和cookie等 uillib ...