升级spring1.2.8.jar到 spring2.5.jar对应的bean.xml文件没做升级出现的错误

[ INFO 2008-12-05 16:02:25 org.springframework.core.CollectionFactory - 66 - <clinit> ] : JDK 1.4+ collections available
[ INFO 2008-12-05 16:02:25 org.springframework.beans.factory.xml.XmlBeanDefinitionReader - 163 - loadBeanDefinitions ] : Loading XML bean definitions from resource loaded from byte array

setConfigReader:Line 1 in XML document from resource loaded from byte array is invalid; nested exception is org.xml.sax.SAXParseException: Document root element "beans", must match DOCTYPE root "null".
java.lang.IllegalStateException: MessageSource not initialized - call 'refresh' before accessing messages via the context: org.springframework.context.support.GenericApplicationContext: display name [org.springframework.context.support.GenericApplicationContext;hashCode=27737404]; startup date [Thu Jan 01 08:00:00 CST 1970]; root of context hierarchy
 at org.springframework.context.support.AbstractApplicationContext.getMessageSource(AbstractApplicationContext.java:646)
 at org.springframework.context.support.AbstractApplicationContext.getMessage(AbstractApplicationContext.java:632)

更改方法

在:<!DOCTYPE beans  ....更新至对应的 spring2.5 对应的声明

 

例如 红色为spring1.2.8的配置文件的文档声明

 

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "
http://www.springframework.org/dtd/spring-beans.dtd">
<beans>

</beans>

 

升级到spring2.5应对配置文件的文档声明改为

 

<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">

 

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<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>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值