I'm trying to migrate a project from Spring 3.0 to Spring 3.1, including moving Spring-security up to newer version. I've created a pom.xml for Maven to manage the dependencies, which it appears to be doing.
When I deploy my build I get the error in the subject " Configuration problem: You must use a 3.0 schema with Spring Security 3.0" and the application cannot start. As I read that, the XML namespace is incorrect for some feature I'm using.
My current namespace for security:
http://www.springframework.org/schema/security http://www.springframework.org/schem...curity-3.1.xsd
Is that right for the new Spring-security libraries?
After a bit of digging it turns out I'm getting some 3.0 jars being deployed with my application, which makes me wonder if that is the root cause of the error I'm seeing (assuming the xsd declaration is correct)....
I've checked through my pom.xml and I am only referencing Spring 3.1.x libraries in there, so I figure the others (3.0.x.jars) are being pulled in as sub dependencies. Sure enough the Eclipse Maven tool to view dependancy tree shows some Spring/spring-security jars depend on 3.0 jars, but my (limited) understanding of Maven tells me that they should be ignored in favour of those closer to the root of the pom file.Code:-rw-r--r-- 1 tomcat tomcat 78088 Jul 3 15:46 spring-security-acl-3.0.5.RELEASE.jar -rw-r--r-- 1 tomcat tomcat 81678 Jul 13 17:36 spring-security-acl-3.1.1.RELEASE.jar -rw-r--r-- 1 tomcat tomcat 7354 Jul 3 15:46 spring-security-aspects-3.0.5.RELEASE.jar -rw-r--r-- 1 tomcat tomcat 6522 Jul 19 02:00 spring-security-aspects-3.1.1.RELEASE.jar -rw-r--r-- 1 tomcat tomcat 185716 Jul 3 15:46 spring-security-config-3.0.5.RELEASE.jar -rw-r--r-- 1 tomcat tomcat 206484 Jul 17 13:04 spring-security-config-3.1.1.RELEASE.jar -rw-r--r-- 1 tomcat tomcat 311038 Jul 3 15:46 spring-security-core-3.0.5.RELEASE.jar -rw-r--r-- 1 tomcat tomcat 346990 Jul 13 17:36 spring-security-core-3.1.1.RELEASE.jar -rw-r--r-- 1 tomcat tomcat 17466 Jul 3 15:46 spring-security-openid-3.0.5.RELEASE.jar -rw-r--r-- 1 tomcat tomcat 19895 Jul 19 02:00 spring-security-openid-3.1.1.RELEASE.jar -rw-r--r-- 1 tomcat tomcat 18883 Jul 3 15:46 spring-security-taglibs-3.0.5.RELEASE.jar -rw-r--r-- 1 tomcat tomcat 20739 Jul 13 17:36 spring-security-taglibs-3.1.1.RELEASE.jar -rw-r--r-- 1 tomcat tomcat 242833 Jul 3 15:46 spring-security-web-3.0.5.RELEASE.jar -rw-r--r-- 1 tomcat tomcat 255466 Jul 13 17:36 spring-security-web-3.1.1.RELEASE.jar
I have defined all these jars at the root of the dependency tree.
So the question is, am I barking up the wrong tree? Is it possible these 3.0 jars could cause the error I'm seeing when I try to use the 3.1 security schema?
If that could be the cause, how do I stop it happening?
I've included my security-context below for review in case I've missed something - which is quite likely as I'm pretty new to the whole Spring thing!
Code:<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" xmlns:context="http://www.springframework.org/schema/context" xmlns:p="http://www.springframework.org/schema/p" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd"> <!-- enable @Secured java annotation <global-method-security pre-post-annotations="enabled" /> --> <!-- these 2 entries are here because of trying to sort different error I get when I set xsd to 3.0.3 as per this error. But I want to work with 3.1 <beans:bean id="expressionHandler" class="org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler" /> <beans:bean id="expressionHandler" class="org.springframework.security.web.access.expression.WebSecurityExpressionHandler" /> --> <!-- for Spring-security >= 3.1 --> <http pattern="/public/**" security="none"/> <http pattern="/login" security="none"/> <http pattern="/loggedOut" security="none"/> <http pattern="/include/css/**" security="none"/> <http pattern="/include/img/**" security="none"/> <http use-expressions="true" auto-config="true" create-session="ifRequired" access-denied-page="/accessDenied" > <form-login login-page="/login" authentication-failure-url="/authfailed" default-target-url="/reports/summaries" /> <logout invalidate-session="true" logout-success-url="/loggedOut" /> <!-- <session-management invalid-session-url="/invalidSession.htm" /> --> <anonymous/> <!-- Spring Security < 3.1 <intercept-url pattern="/public/**" filters="none"/> <intercept-url pattern="/login" filters="none"/> <intercept-url pattern="/loggedOut" filters="none"/> <intercept-url pattern="/include/css/**" filters="none"/> <intercept-url pattern="/include/img/**" filters="none"/> --> <!-- isAuthenticated() hasRole('ROLE_REPORTS') --> <intercept-url pattern="/reports/**" method="GET" access="hasRole('ROLE_REPORTS')" /> <intercept-url pattern="/super/**" method="GET" access="hasRole('ROLE_SUPER')" /> <intercept-url pattern="/user/userCP" method="GET" access="isAuthenticated()" /> <intercept-url pattern="/user/userCP" method="PUT" access="isAuthenticated()" /> <intercept-url pattern="/admin/**" access="hasRole('ROLE_ADMIN')" /> <intercept-url pattern="/data/**" method="GET" access="isAuthenticated()" /> <intercept-url pattern="/data/**" method="DELETE" access="hasRole('ROLE_ADMIN')" /> <intercept-url pattern="/data/**" method="POST" access="hasRole('ROLE_ADMIN')" /> <intercept-url pattern="/data/**" method="PUT" access="hasRole('ROLE_ADMIN')" /> <intercept-url pattern="/include/js/pages/admin/**" access="hasRole('ROLE_ADMIN')" /> <intercept-url pattern="/include/js/pages/all.js" access="isAuthenticated()" /> <intercept-url pattern="/include/js/pages/**" access="hasRole('ROLE_REPORTS')" /> <intercept-url pattern="/include/js/**" access="hasRole('ROLE_ANONYMOUS')" /> <intercept-url pattern="/include/**" access="isAuthenticated()" /> </http> <beans:import resource="hibernate-context.xml" /> <context:component-scan base-package="uk.co.romar.guardian.services" /> <beans:bean id="userService" class="uk.co.romar.guardian.services.UserServiceImpl" /> <beans:bean id="pwdEncoder" class="org.springframework.security.authentication.encoding.ShaPasswordEncoder" /> <!-- <beans:bean id="saltSource" class="??"/> --> <authentication-manager alias="authenticationManager"> <authentication-provider user-service-ref="userService"> <password-encoder ref="pwdEncoder" /> </authentication-provider> </authentication-manager> </beans:beans>



Reply With Quote

