Mais de uma pagina de login com spring security 3.1

fala ai pessoal, sou iniciante em java e estou desenvolvendo uma aplicacao web que precisa ser acessada por dois tipos de usuarios.
entao comecei a utilizar o framework spring security e consegui fazer com q aplicação funcionasse perfeitamente como eu queria, porem um pequeno problema apareceu. eu quero que esses dois tipos de usuarios se loguem em paginas diferentes seriam duas paginas de login distintas uma para cada tipo de usuario. mas não estou conseguindo fazer essa configuração no spring security, lembrando que com uma pagina de login apenas tudo funciona perfeitamente.
ja tentei varias configurações, segue abaixo a ultima tentativa:

aplicationContext do spring security:

<?xml version="1.0" encoding="UTF-8"?>
<!-- data source -->
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    <property name="driverClassName" value="com.mysql.jdbc.Driver" />
	<property name="url" value="jdbc:mysql://localhost/actionvox" />
	<property name="username" value="root" />
	<property name="password" value="502010" />
</bean>


 <sec:http auto-config="true"  access-denied-page="/negado.jsp">
	<sec:form-login login-page="/identificacao-audio.jsp"  authentication-failure-url="/erro-login-audio.jsp" />
	<sec:intercept-url pattern="/audiodescricao/**" access="ROLE_AUDIO" />
	<sec:intercept-url pattern="/sem-audio/**" access="ROLE_SEMAUDIO" />
	<sec:intercept-url pattern="/**" access="IS_AUTHENTICATED_ANONYMOUSLY" />
</sec:http>

 <sec:http auto-config="true"   access-denied-page="/negado.jsp">
       <sec:form-login login-page="/identificacao-semaudio.jsp" default-target-url="/sem-audio/index.jsp" authentication-failure-    url="/erro-login-semaudio.jsp" />
	   <sec:intercept-url pattern="/audiodescricao/**" access="ROLE_AUDIO" />
	   <sec:intercept-url pattern="/sem-audio/**" access="ROLE_SEMAUDIO" />
	   <sec:intercept-url pattern="/**" access="IS_AUTHENTICATED_ANONYMOUSLY" />
</sec:http>

<sec:authentication-manager>
	<sec:authentication-provider>
    	<sec:jdbc-user-service data-source-ref="dataSource" 
        users-by-username-query="SELECT cpf, localizador, 'true' as enable FROM passageiro  WHERE cpf=?"
        authorities-by-username-query="SELECT cpf, permissao FROM passageiro WHERE cpf=?" />
	</sec:authentication-provider>
</sec:authentication-manager>

Mas essa configuração me lança uma stacktrace no servidor:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘org.springframework.security.filterChainProxy’: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: A universal match pattern (’/**’) is defined before other patterns in the filter chain, causing them to be ignored. Please check the ordering in your security:http namespace or FilterChainProxy bean configuration
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1422)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:518)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:455)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)

AGUARDO A AJUDA DOS AMIGOS !!!

Olá,
Esta me parecendo conflito nas nos seus intercept-url, no seu primeiro bloco http remova essa diretiva :
<sec:intercept-url pattern="/**"access=“IS_AUTHENTICATED_ANONYMOUSLY” />

O patern /** tem que ser o ultimo, pois o Spring Security faz a leitura na ordem que foi declarado, com isso na sua configuração a segunda tag http
esta sendo completamente anulada.

abraço!

ola mmaico removi a diretiva como vc aconselhou, mas continua dando o mesmo erro.
valeu pela resposta.

andysteel,
Acho que o problema esta nas urls que são iguals nas duas diretivas, geralmente se faz esse tipo de configuração, mas se adicionar um prefixo diferente no pattern.

O seu sistema de login é igual para os dois casos? você só quer trocar a pagina?

Tenta usar alguma coisa assim login-page="/identificacao-*.jsp.

Se não funcionar procure por AuthenticationEntryPoint, que é um novo recurso do Spring Security 3.1, e irá te ajudar nisso!

até!

mmaico obrigado pela ajuda, ainda não tive tempo para testar essa solução. assim q eu testar eu posto aqui o resultado.

Bom dia,

Estou com o mesmo erro

Caused by: java.lang.IllegalArgumentException: A universal match pattern ('/**') is defined  before other patterns in the filter chain, causing them to be ignored. Please check the ordering in your &lt;security:http&gt; namespace or FilterChainProxy bean configuration
	at org.springframework.security.config.http.DefaultFilterChainValidator.checkPathOrder(DefaultFilterChainValidator.java:49)
	at org.springframework.security.config.http.DefaultFilterChainValidator.validate(DefaultFilterChainValidator.java:39)
	at org.springframework.security.web.FilterChainProxy.afterPropertiesSet(FilterChainProxy.java:151)

As minhas configurações estão assim (estou jogando o trecho pra não poluir mto):
web.xml:


&lt;servlet&gt;
		&lt;servlet-name&gt;appServlet&lt;/servlet-name&gt;
		&lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
		&lt;init-param&gt;
			&lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
			&lt;param-value&gt;/WEB-INF/spring/app/servlet-context.xml&lt;/param-value&gt;
		&lt;/init-param&gt;
		&lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
	&lt;/servlet&gt;

	&lt;servlet-mapping&gt;
		&lt;servlet-name&gt;appServlet&lt;/servlet-name&gt;
		&lt;url-pattern&gt;/service/*&lt;/url-pattern&gt;
	&lt;/servlet-mapping&gt;   

	&lt;!-- Spring Security --&gt;
	&lt;filter&gt;
		&lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt;
		&lt;filter-class&gt;org.springframework.web.filter.DelegatingFilterProxy&lt;/filter-class&gt;
	&lt;/filter&gt;
 
	&lt;filter-mapping&gt;
		&lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt;
		&lt;url-pattern&gt;/service/*&lt;/url-pattern&gt;
	&lt;/filter-mapping&gt;

spring-security-modulo1

&lt;http create-session="never" auto-config="false" realm="Restricted Service"&gt;
        &lt;intercept-url pattern="/service/rest/seguranca/**" access="ROLE_USER" /&gt;
        &lt;http-basic /&gt;
        &lt;logout /&gt;
    &lt;/http&gt;

spring-security-modulo2

    &lt;http create-session="never" auto-config="false" realm="Restricted Service"&gt;
        &lt;intercept-url pattern="/service/rest/instituicao/**" access="ROLE_INSTITUICAO"/&gt;
        &lt;http-basic /&gt;
        &lt;logout /&gt;
    &lt;/http&gt;

Não tenho muita experiência com Spring, mas pelo que entendi o existe uma ordem a respeitar no interceptor.

Tava tentando debugar a classe do spring e não saquei o que está exatamente dando pau, mas a exceção está ocorrendo no trecho da classe org.springframework.security.config.httpDefaultFilterChainValidator.

private void checkPathOrder(List&lt;SecurityFilterChain&gt; filterChains) {
        // Check that the universal pattern is listed at the end, if at all
        Iterator&lt;SecurityFilterChain&gt; chains = filterChains.iterator();

        while (chains.hasNext()) {
            if (((DefaultSecurityFilterChain)chains.next()).getRequestMatcher() instanceof AnyRequestMatcher && chains.hasNext()) {
                throw new IllegalArgumentException("A universal match pattern ('/**') is defined " +
                        " before other patterns in the filter chain, causing them to be ignored. Please check the " +
                        "ordering in your &lt;security:http&gt; namespace or FilterChainProxy bean configuration");
            }
        }
    }