Maxiq
Maxiq

Reputation: 133

security.xml strange error using Spring

I am trying to configure Spring Security in my simple application. Here is my configuration file, security.xml:

<beans:beans xmlns="http://www.springframework.org/schema/security"
    xmlns:b="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:jdbc="http://www.springframework.org/schema/jdbc"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
                        http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
                        http://www.springframework.org/schema/jdbc
                        http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd
                        http://www.springframework.org/schema/security
                        http://www.springframework.org/schema/security/spring-security-3.0.xsd">
    <http>
        <form-login login-page="/login/" authentication-failure-url="/fail/" />
        <logout logout-success-url="/" />
    </http>

    <authentication-manager>
        <authentication-provider user-service-ref='myUserDetailsService' />
    </authentication-manager>

    <b:bean id="myUserDetailsService" class="my.package.security.MyUserDataService" />
</beans:beans>

I got following errors with deploying:

The prefix "beans" for element "beans:beans" is not bound.

How can I fix this problem?

Upvotes: 1

Views: 4723

Answers (2)

Dave Newton
Dave Newton

Reputation: 160191

You're declaring the namespace as b: and using it everywhere except the enclosing beans tag, in which you're using beans:beans instead of b:beans.

Upvotes: 0

skaffman
skaffman

Reputation: 403481

You're missing up the beans and b prefixes. You've declared the b prefix, and then used the beans one. You need to pick one and stick with it. For example, replace

xmlns:b="http://www.springframework.org/schema/beans" 

with

xmlns:beans="http://www.springframework.org/schema/beans" 

and then

<b:bean...

with

<beans:bean...

Upvotes: 7

Related Questions