eclipse项目报错怎么解决class path resource [beans.xml] cannot be opened because it does not exist
来源:互联网 发布:mac怎么截图怎么保存 编辑:程序博客网 时间:2024/06/04 19:42
50
Defeatself | 浏览 7866 次
发布于2015-02-03 23:07最佳答案
从错误提示显示资源beans.xml不存在,无法打开。
源目录下beans.xml是不是没有拷贝,一般这种情况是用spring,
如果是的话,你需要用ClassPathXmlApplicationContext类加载你的资源文件,比如:
String[] springConf = {"beans.xml"};
AbstractApplicationContext ctx = new ClassPathXmlApplicationContext(springConf);
Main main = ctx.getBean("main", Main.class);
最后的Main是一个类,在spring容器中为bean,获取这个bean的实例。如果不是用spring,请将你的代码贴出来。
0 0
- eclipse项目报错怎么解决class path resource [beans.xml] cannot be opened because it does not exist
- java.io.FileNotFoundException: class path resource [beans.xml] cannot be opened because it does not exist 解决方法
- java.io.FileNotFoundException: class path resource [beans.xml] cannot be opened because it does not
- java.io.FileNotFoundException: class path resource [beans.xml] cannot be opened because it does not
- 关于class path resource [applicationContext.xml] cannot be opened because it does not exist
- class path resource [META-INF/xfire/services.xml] cannot be opened because it does not exist
- class path resource [spring.xml] cannot be opened because it does not exist
- class path resource [applicationContext.xml] cannot be opened because it does not exist
- Spring问题:class path resource [xxx.xml] cannot be opened because it does not exist
- class path resource [applicationContext.xml] cannot be opened because it does not exist
- class path resource [spring-mvc.xml] cannot be opened because it does not exist
- spring class path resource [jdbc.properties] cannot be opened because it does not exist
- java.io.FileNotFoundException: class path resource ..cannot be opened because it does not exist
- java.io.FileNotFoundException: class path resource [META-INF/xfire/services.xml] cannot be opened because it does not exist
- IDEA中Spring配置错误:class path resource [.xml] cannot be opened because it does not exist
- class path resource [spring.xml] cannot be opened because it does no exist;
- java.io.FileNotFoundException: class path resource [bean.xml] cannot be opened because it does not e
- java.io.FileNotFoundException: class path resource [spring.xml] cannot be opened because it does not
- SPOJ 17128 PUTNIK
- IoC容器装配Bean 上
- 第二章 PX4-Pixhawk-RCS启动文件解析
- WebStorm:let definenation are not supported by current JavaScript version解决方案
- IDEA如何设置不区分代码的大小写
- eclipse项目报错怎么解决class path resource [beans.xml] cannot be opened because it does not exist
- update-rc.d---ubuntu中替代chkconfig
- iOS NSFileManager文件操作
- Linux文本处理三剑客(grep)
- BZOJ 2306: [Ctsc2011]幸福路径
- 第三章 PX4-Pixhawk-SPI底层驱动解析
- c++第四次作业报告
- leetcode题解-169. Majority Element && 189. Rotate Array
- GitHub环境配置