class path resource [applicationContext.xml]; nested exception is java.io.FileNotFoundException: cla
来源:互联网 发布:3b编程简单图形实例 编辑:程序博客网 时间:2024/05/29 02:08
CH10.Spring 框架的开发与应用
package src.com.qdu.sun.Spring;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.ClassPathResource;
public class SpringTest {
public static void main( String[] args ){
BeanFactory factory = new XmlBeanFactory( new ClassPathResource("applicationContext.xml") );
HelloWorld gc = (HelloWorld)factory.getBean("greetingService");
gc.sayGreeting();
}
}
log4j:WARN No appenders could be found for logger (org.springframework.util.ClassUtils).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from
class path resource [applicationContext.xml]; nested exception is java.io.FileNotFoundException: class path resource
[applicationContext.xml] cannot be opened because it does not exist
Caused by: java.io.FileNotFoundException: class path resource [applicationContext.xml] cannot be opened because it does not exist
at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:135)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:297)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:280)
at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(XmlBeanFactory.java:73)
at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(XmlBeanFactory.java:61)
at src.com.qdu.sun.Spring.SpringTest.main(SpringTest.java:9)
修改为:
public class SpringTest {
public static void main( String[] args ){
BeanFactory factory = new XmlBeanFactory( new ClassPathResource("src/applicationContext.xml") );
输出:
log4j:WARN No appenders could be found for logger (org.springframework.util.ClassUtils).
log4j:WARN Please initialize the log4j system properly.
you yi ge greeting
- class path resource [applicationContext.xml]; nested exception is java.io.FileNotFoundException: cla
- nested exception is java.io.FileNotFoundException: class path resource [applicationContext.xml] cann
- java cxf nested exception is java.io.FileNotFoundException: class path resource [META-INF/cxf/cxf-ex
- nested exception is java.io.FileNotFoundException: class path resource [spring/spring-datasource-mog
- Invocation of init method failed; nested exception is java.io.FileNotFoundException: class path reso
- Caused by: java.io.FileNotFoundException: class path resource [applicationContext.xml] cannot be ope
- Caused by: java.io.FileNotFoundException: class path resource [applicationContext.xml] cannot be ope
- java.io.FileNotFoundException: class path resource [applicationContext.xml] cannot be opened because
- FAQ(19):java.io.FileNotFoundException: class path resource [resources/applicationContext.xml] cannot
- nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/
- nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/
- nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/jdbc.pro
- nested exception is java.io.FileNotFoundException: config.xml (系统找不到指定的文件。)
- XML document from class path resource [beans.xml] is invalid; nested exception is org.xml.sax.SAXPar
- java.io.FileNotFoundException: class path resource [META-INF/xfire/services.xml] cannot be opened b
- java.io.FileNotFoundException: class path resource [beans.xml] cannot be opened because it does not
- java.io.FileNotFoundException: class path resource [XXXXX.xml] cannot be opened
- java.io.FileNotFoundException: class path resource [beans.xml] cannot be opened because it does not
- 死鎖查詢2
- JavaScript 页面跳转
- 一致性Hash算法
- 电脑配置单3(自用勿删)
- 管理碎片时间 在等待中创造金钱 穆利堂推荐
- class path resource [applicationContext.xml]; nested exception is java.io.FileNotFoundException: cla
- 根據表格獲取字段名稱及類型
- Github -- Git[版本追踪] 强大的Linux内核开发工具使用
- 颈椎操
- 电脑配置单4(自用勿删)
- 抓取表格字段名稱,類型及其長度
- Ubuntu 11.04 使用compiz标题栏丢失解决方案
- 套接字函数详细介绍
- Request.ServerVariables["Url"]