我正在尝试从spring framework 3.0.5迁移到3.1,spring-security 3.0.5迁移到3.1(更不用说hibernate 3.6到4.1)。使用Apache IVY。
我在Eclipse Helios中尝试启动Tomcat 7.23时遇到以下错误(在其他主机中,但这是控制台中的最后一个):
org.springframework.beans.factory.BeanDefinitionStoreException: Line 7 in XML document from ServletContext resource [/WEB-INF/focus-security.xml] is invalid; nested exception is org.xml.sax.SAXParseException: Document root element "beans:beans", must match DOCTYPE root "null".
org.xml.sax.SAXParseException: Document root element "beans:beans", must match DOCTYPE root "null".
我的安全配置文件如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/security"
xmlns:beans="http://www.springframework.org/schema/beans" xmlns:jdbc="http://www.springframework.org/schema/jdbc"
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-3.1.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.1.xsd">
Ivy.xml看起来像这样:
<dependencies>
<dependency org="org.hibernate" name="hibernate-core" rev="4.1.7.Final"/>
<dependency org="org.hibernate" name="com.springsource.org.hibernate.validator" rev="4.2.0.Final" />
<dependency org="org.hibernate.javax.persistence" name="hibernate-jpa-2.0-api" rev="1.0.1.Final"/>
<dependency org="org.hibernate" name="hibernate-entitymanager" rev="4.1.7.Final"/>
<dependency org="org.hibernate" name="hibernate-validator" rev="4.3.0.Final"/>
<dependency org="org.springframework" name="spring-context" rev="3.1.2.RELEASE"/>
<dependency org="org.springframework" name="spring-web" rev="3.1.2.RELEASE"/>
<dependency org="org.springframework" name="spring-tx" rev="3.1.2.RELEASE"/>
<dependency org="org.springframework" name="spring-webmvc" rev="3.1.2.RELEASE"/>
<dependency org="org.springframework" name="spring-test" rev="3.1.2.RELEASE"/>
<dependency org="org.springframework.security" name="spring-security-core" rev="3.1.2.RELEASE"/>
<dependency org="org.springframework.security" name="spring-security-web" rev="3.1.2.RELEASE"/>
<dependency org="org.springframework.security" name="spring-security-config" rev="3.1.2.RELEASE"/>
<dependency org="org.springframework.security" name="spring-security-taglibs" rev="3.1.2.RELEASE"/>
<dependency org="net.sf.dozer" name="dozer" rev="5.3.2"/>
<dependency org="org.apache.poi" name="poi" rev="3.8"/>
<dependency org="commons-io" name="commons-io" rev="2.4"/>
<dependency org="org.slf4j" name="slf4j-api" rev="1.6.6"/>
<dependency org="org.slf4j" name="slf4j-log4j12" rev="1.6.6"/>
<dependency org="org.slf4j" name="slf4j-ext" rev="1.6.6"/>
<dependency org="log4j" name="log4j" rev="1.2.17"/>
<dependency org="org.testng" name="testng" rev="6.8"/>
<dependency org="org.dbunit" name="dbunit" rev="2.4.8"/>
<dependency org="org.easymock" name="easymock" rev="3.1"/>
</dependencies>
我理解(希望)此错误是由于声明的xsd与类路径上的jar之间不匹配造成的。任何指针都将非常感激。
答案 0 :(得分:0)
尝试使用模式位置:xsi:schemaLocation =“http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd”这也指向最新的模式。同时删除tomcat中的工作文件夹以确保没有冲突..