开发者

XML schema error with Jetty

I got a problem with my spring configuration when I run it in jetty. I used the exact same file in tomcat without any problems. The error i get is the following.

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 | '.

My schema looks like this.

<?xml version="1.0" encoding="UTF-8"?>
<beans开发者_如何学Python: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">

I have no idea what can be wrong. Have tested it with 2 different configurations and both gave this error.


The following URL seems invalid, and redirects to springsource.org

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

Can you try that one?

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


I think it is the spring security part that is messing this up look at Spring 3.0 - Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/security] for a solution. (Short recap you are missing the Spring Security Config jar in your classpath add the below dependency if you are using maven)

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


Obviously you can not have a newline character inside XML attribute.

Put xsi:schemaLocation attribute value all inside one line.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜