DarkCoffee
DarkCoffee

Reputation: 950

Failed to read schema document of spring.security

My spring-security.xml is

<beans:beans xmlns="http://www.springframework.org/schema/security"
    xmlns:beans="http://www.springframework.org/schema/beans" 
    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.2.xsd"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">


<http auto-config="true">
    <intercept-url pattern="/admin**" access="ROLE_USER" />
</http>

<authentication-manager>
  <authentication-provider>
    <user-service>
    <user name="admin" password="admin" authorities="ROLE_USER" />
    </user-service>
  </authentication-provider>
</authentication-manager>

When I start the server (Tomcat 7) inside Eclipse I get this error:

Ignored XML validation warning org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/security/spring-security-3.2.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not .

The libraries I've imported are:

commons-logging

I believe there are some problems with the library version, but I'm not sure. I tried to search the version 4.0.4 but I haven't found it.

Is the spring-security library included in another one? If yes, where can I look into when I need to know the unifications between the spring versions?

How can I solve the error?

I googled all my questions but I haven't found anything.

Upvotes: 3

Views: 12458

Answers (1)

Andrei Stefan
Andrei Stefan

Reputation: 52368

Your xml file should start with something like this:

<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.2.xsd">

and the .xsd schemas are in spring-security-config jar.

Upvotes: 4

Related Questions