Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tomcat complaining about spring-security-3.1.xsd not matching Spring Security 3.2, but not referencing 3.1 anywhere

The error message:

SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from relative location [security-config.xml]

Offending resource: ServletContext resource [/WEB-INF/spring/app-config.xml]; nested exception is org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: You cannot use a spring-security-2.0.xsd or spring-security-3.0.xsd or spring-security-3.1.xsd schema with Spring Security 3.2. Please update your schema declarations to the 3.2 schema.

Offending resource: ServletContext resource [/WEB-INF/spring/security-config.xml]

My "security-config.xml" file:

<beans xmlns:s="http://www.springframework.org/schema/security"
       xmlns="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-4.0.xsd
                    http://www.springframework.org/schema/security
                    http://www.springframework.org/schema/security/spring-security-3.2.xsd">

my pom.xml:

    <properties>
        <spring.version>4.1.4.RELEASE</spring.version>
        <spring.security.version>3.2.5.RELEASE</spring.security.version>
        <spring.ldap.version>2.0.2.RELEASE</spring.ldap.version>
        <spring.data.oracle.version>1.1.0.RELEASE</spring.data.oracle.version>

...

    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-core</artifactId>
            <version>${spring.security.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-config</artifactId>
            <version>${spring.security.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-web</artifactId>
            <version>${spring.security.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.ldap</groupId>
            <artifactId>spring-ldap-core</artifactId>
            <version>${spring.ldap.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-ldap</artifactId>
            <version>${spring.security.version}</version>
        </dependency>
...
    </dependencies>

Why am I getting this error message? What other files might be involved?

like image 565
Greg Dougherty Avatar asked May 13 '15 18:05

Greg Dougherty


1 Answers

Since you are using spring 4.1.4.RELEASE use the appropriate schema for that version, which is spring-beans-4.1.xsd.

And make sure that it isn't some cache issues on server side. Clean server and project, build your project and deploy.

like image 180
Aleksandr M Avatar answered Oct 08 '22 09:10

Aleksandr M