André Schuster
André Schuster

Reputation: 165

Spring "alias is required"

I'm new in Spring and I'm trying to create a application using Spring Blazeds Integration (Flex + Blazeds + Spring + Java) and when I run the application I got this error:

02:51:21,852 INFO  [XmlBeanDefinitionReader] Loading XML bean definitions from ServletContext resource [/WEB-INF/spring/security-config.xml]
02:51:23,937 ERROR [ContextLoader] Context initialization failed
    org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: alias is required.
    Offending resource: ServletContext resource [/WEB-INF/spring/security-config.xml]

The security-config.xml:

<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns:security="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.xsd">

    <security:http>
        <security:anonymous enabled="false" />
        <security:form-login default-target-url="/myContext/Index.html"
            login-page="/myContext/Login.html" />
        <security:remember-me key="myAppKey" services-ref="rememberMeServices" />
    </security:http>

    <beans:bean id="rememberMeServices"
        class="org.springframework.security.web.authentication.rememberme.TokenBasedRememberMeServices">
        <beans:property name="key" value="myAppKey" />
        <beans:property name="alwaysRemember" value="true" />
    </beans:bean>

    <security:authentication-manager>
        <security:authentication-provider>
            <security:user-service>
                <security:user name="john" password="john" authorities="ROLE_USER" />
                <security:user name="admin" password="admin" authorities="ROLE_USER, ROLE_ADMIN" />
                <security:user name="guest" password="guest" authorities="ROLE_GUEST" />
            </security:user-service>
        </security:authentication-provider>
    </security:authentication-manager>

</beans:beans>

I'm using spring-flex 1.5.0, spring-security 2.0.6 and Spring 3.0.

Any ideas what is the problem?

Thanks in advance, Andre

Upvotes: 0

Views: 3620

Answers (2)

Peter Mularien
Peter Mularien

Reputation: 2638

As listed in the reference manual, Spring Flex 1.5.0 will not work with Spring Security 2. You must use Spring Security 3.

Other than this, jbbarquero is correct, assuming this is actually your problem.

Upvotes: 0

jbbarquero
jbbarquero

Reputation: 2842

I'm not very sure, but try to put an alias in security:authentication-manager:

<security:authentication-manager alias="authenticationManager">

Why don't you use Spring security 3?

Upvotes: 1

Related Questions