[英]XML schema error with 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種不同的配置對其進行了測試,並且都給出了此錯誤。
以下網址似乎無效,並重定向到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
我認為正是Spring安全性部分使Spring 3.0陷入困境-無法找到XML模式名稱空間的Spring NamespaceHandler [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>
顯然,XML屬性中不能包含換行符。
將xsi:schemaLocation
屬性值全部放在一行中。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.