学习SSH时遇到的一个问题,转载自http://llyzq.iteye.com/blog/1117288
今天碰到一个奇怪的问题,spring在初始化xml配置文件的时候报错:
Cannot find the declaration of element 'beans'
spring配置文件原来是这样写的:
<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 org/springframework/beans/factory/xml/spring-beans-2.0.xsd"
default-lazy-init="true">
最后找到解决方法
<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
classpath:/org/springframework/beans/factory/xml/spring-beans-2.0.xsd"
default-lazy-init="true">
需要增加“classpath:/”
原帖 http://www.jnan.org/archives/2010/12/cannot-find-the-declaration-of-element-beans.html