日期:2014-05-17  浏览次数:20664 次

Spring 配置文件出现错误!急.....
配置文件出现错误
我在建web project,add Spring capabilities..后。在web-inf/spring-config自动生成的配置文件出现错误。
错误提示:
spring referenced file contains errors (http://www.springframework.org/schema/beans/spring-beans-2.0.xsd)

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

我是在myEclipse5.5做的,以前都没有碰过这种情况,今天郁闷了。虽然有错误提示,但程序还可以正常运行哦。有了错误提示,很多关键字都要亲自敲过。请问下有什么方法可以解决的吗?

------解决方案--------------------
也许你的网络问题。你是不是在内网啊!
eclipse 不能连接外网的原因!
------解决方案--------------------
lz改为这个试一试,我这边没有问题。

XML code

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

配置你的bean

</beans>

------解决方案--------------------
建议自己修改dtd,或者schema,指向本地
------解决方案--------------------
eclipse 相关文件损坏??
重新配置一下
或者这个链接(http://www.springframework.org/schema/beans/spring-beans-2.0.xsd)
重新拷贝一个试试?
------解决方案--------------------
探讨
我是在内网呀,但是前两天都是没有问题的哦。

------解决方案--------------------
XML code

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="
       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
       http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
       http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd">