beans.factory.BeanDefinitionStoreException 问题出在beans.factory,那么到底是哪呢?spring的配置文件里,也就是你要加载的配置文件beans,找到的对象是空,
出错的常见情况:
spring版本不一致,比如有的用Spring2.0,3.0
举例:
在往Spring2.0项目中添加XFire时(Myeclipse)出现如下错误
Document root element "beans", must match DOCTYPE root "null".
原因:XFire Core lib 中有Spring1.2.6 与Spring 2 冲突!
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
</beans>
spring 1.x 使用DOCTYPE,而2.x是用schema,把
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
删掉,改为
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" " http://www.springframework.org/dtd/spring-beans.dtd">
<beans></beans>
往往在myeclipse中添加spring支持时,需要选择版本,后来在eclipse工具中用到spring的web工程,不想装myeclipse,就遇到这个问题了,不过不是很难。
继续练习,用eclipse学东西自己安装需要的插件,觉得学的清晰些,整个过程比较清晰,个人建议而已。
当然零基础的还是用 myeclipse比较,有现成的工具,就直接用!