java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh
2013-05-14 09:52
495 查看
报错信息:java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
大概看一下错误信息:BeanFactory没有实例化或者已经关闭,原因很简单:ApplicationContext ctx = new ClassPathXmlApplicationContext();Spring实例化BeanFactory的时候是默认到classPath下面查找名为applicationContext.xml的文件。但是这正是这个错误的原因:ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");如果这样的话就不会出现这样的错误了。
大概看一下错误信息:BeanFactory没有实例化或者已经关闭,原因很简单:ApplicationContext ctx = new ClassPathXmlApplicationContext();Spring实例化BeanFactory的时候是默认到classPath下面查找名为applicationContext.xml的文件。但是这正是这个错误的原因:ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");如果这样的话就不会出现这样的错误了。
相关文章推荐
- java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' bef
- java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' befo
- java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' befo
- java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' befo
- java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' befo
- java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the A
- java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' befo
- java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' befo
- java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' befo
- java.lang.IllegalStateException: BeanFactory not initialized or already closed
- spring整合jax-ws时报错(java.lang.IllegalStateException: BeanFactory not initialized or already closed)
- 配置文件加载异常java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refre
- spring注解过程中java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 're
- java.lang.IllegalStateException: BeanFactory not initialized or already closed
- BeanFactory not initialized or already closed - call 'refresh' before access
- ActiveMQ常见错误一: BeanFactory not initialized or already closed - call 'refresh' before accessing beans
- BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the Applic
- spring配置出错: BeanFactory not initialized or already closed - call 'refresh' before accessing beans vi
- 报错 BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext 的解决方法
- maven项目-加载不到spring文件,BeanFactory not initialized or already closed - call 'refresh' bef