Jetty的XML模式错误

时间:2010-11-30 12:54:09

标签: java xml xsd spring-security jetty

当我在码头上运行时,我的弹簧配置出了问题。我在tomcat中使用完全相同的文件没有任何问题。我得到的错误如下。

org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 6 in XML document from ServletContext resource [/WEB-INF/web-application-context.xml] is invalid; nested exception is org.xml.sax.SAXParseException: s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'SpringSource.org | '.
Caused by: org.xml.sax.SAXParseException: s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'SpringSource.org | '.

我的架构看起来像这样。

<?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: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.0.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.0.5.xsd">

我不知道什么是错的。已经使用2种不同的配置进行了测试,并且都出现了这个错误。

3 个答案:

答案 0 :(得分:2)

以下网址似乎无效,并重定向到springsource.org

http://www.springframework.org/schema/security/spring-security-3.0.5.xsd

你能尝试一下吗?

http://www.springframework.org/schema/security/spring-security-3.0.4.xsd

答案 1 :(得分:1)

我认为春季安全部分正在弄清楚Spring 3.0 - Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/security]的解决方案。 (简要回顾一下,如果您使用maven,则缺少类路径中的Spring Security Config jar添加以下依赖项)

<dependency>
    <groupId>org.springframework.security</groupId>
    <artifactId>spring-security-config</artifactId>
    <version>3.0.1.RELEASE</version>
</dependency>

答案 2 :(得分:0)

显然,你不能在XML属性中包含换行符。

xsi:schemaLocation属性值全部放在一行内。

相关问题