1

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

Mark Baijens
  • 13,028
  • 11
  • 47
  • 73

3 Answers3

2

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
Brian Clozel
  • 56,583
  • 15
  • 167
  • 176
  • Ah tnx. such simple solution. I expected an other error for invalid schema locations since I got such error before. Still got same error but now more detailed. – Mark Baijens Nov 30 '10 at 13:24
1

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>
Community
  • 1
  • 1
Konstantin
  • 3,626
  • 2
  • 33
  • 45
0

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

Put xsi:schemaLocation attribute value all inside one line.

Peter Knego
  • 79,991
  • 11
  • 123
  • 154
  • I think this answer is wrong see for instance http://stackoverflow.com/a/449647/90033 – Konstantin Nov 18 '14 at 21:47
  • @Konstantin: this is not the question of XML standards, but a problem that happens when this particular parser can not load an external schema. – Peter Knego Nov 20 '14 at 09:15
  • I know but your answer seems to imply that he cant have newlines in xml attributes which is incorrect – Konstantin Nov 20 '14 at 09:51