class path resource [beans.xml] cannot be opened because it does not exist

严重: 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 [beans.xml]; nested exception is java.io.FileNotFoundException: class path resource [beans.xml] cannot be opened because it does not exist 
at 

在spring与hibernate4整合的时候,报出这样的错误,但是我的beans.xml文件就是在src/test/resources包下放置着,并且我通过@ContextConfiguration("/beans.xml")这个去初始化spring,但是为什么会找不到呢?

错误是:在classpath中没有找到beans.xml文件,于是我很自然的想到去eclipse中的classpath文件中去查看,最终发现确实没有这样一句话:<classpathentry kind="src" path="src/test/resources"/>,那就说明没有把此目录映射的classpath中,此时感到很是不解,难道是eclipse下的maven有问题?解决方法:我把src/test/resources这个目录删掉,然后重新创建了此目录,并且创建了beans.xml文件之后,一切正常!!!   

但是目前为止,我也不知道具体为什么会出现这种问题,以上就算是一种解决方法吧!!!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值