title: Spring Security multiple entry points - login process URL not found
body: <p>I rewrite the security configuration class from <a href="http://websystique.com/springmvc/spring-mvc-4-and-spring-security-4-integration-example/" rel="nofollow noreferrer">this</a> tutorial.</p>
  
  <p>I try to enter the entries without login, the server redirect to the login page well, but submit the user credentials to login processing URL return page not found. How should I fix it?</p>
  
  <p>My Spring Security configuration:</p>
  
  <pre class="lang-java prettyprint-override"><code>@Configuration
  @EnableWebSecurity
  public class SecurityConfiguration {
  
      @Autowired
      @Qualifier("customUserDetailsService")
      UserDetailsService userDetailsService;
  
      @Autowired
      PersistentTokenRepository tokenRepository;
  
      @Autowired
      public void configureGlobalSecurity(AuthenticationManagerBuilder auth) throws Exception {
          auth.userDetailsService(userDetailsService);
          auth.authenticationProvider(authenticationProvider());
      }
  
      @Configuration
      @Order(1)
      ublic static class MobileSecurityConfiguration extends WebSecurityConfigurerAdapter {
  
          @Override
          protected void configure(HttpSecurity http) throws Exception {
  
              http
                  .antMatcher("/mobile/**")
                  .authorizeRequests()
                      .anyRequest().hasRole("MOBILE")
                      .and()
                  .formLogin()
                      .loginPage("/mobile_login")
                      .loginProcessingUrl("/mobile_login_processing_url")
                      .usernameParameter("ssoId")
                      .passwordParameter("password")
                      .defaultSuccessUrl("/mobile/menu")
                      .and()
                  .logout()
                      .logoutUrl("/mobile_logout")
                      .logoutSuccessUrl("/mobile_login?logout")
                      .deleteCookies("JSESSIONID")
                      .and()
                  .exceptionHandling()
                      .accessDeniedPage("/Access_Denied")
                      .defaultAuthenticationEntryPointFor(authenticationEntryPoint(), new AntPathRequestMatcher("/mobile/**"));
          }
  
          @Bean
          Public AuthenticationEntryPoint authenticationEntryPoint(){
              return new LoginUrlAuthenticationEntryPoint("/mobile_login");
          }
      }
  
      @Configuration
      @Order(2)
      public static class WebSecurityConfiguration extends WebSecurityConfigurerAdapter {
  
          @Autowired
          PersistentTokenRepository tokenRepository;
  
          @Override
          protected void configure(HttpSecurity http) throws Exception {
              http
                  .authorizeRequests()
                      .antMatchers("/web/**").hasRole("ADMIN")
                      .and()
                  .formLogin()
                      .loginPage("/web_login")
                      .loginProcessingUrl("/web_login_processing_url")
                      .usernameParameter("ssoId")
                      .passwordParameter("password")
                      .defaultSuccessUrl("/web/list")
                      .and()
                  .logout()
                      .logoutUrl("/logout")
                      .logoutSuccessUrl("/web_login?logout")
                      .deleteCookies("JSESSIONID")
                      .and()
                  .exceptionHandling().accessDeniedPage("/Access_Denied");
          }
      }
  
      @Bean
      public PasswordEncoder passwordEncoder() {
          return new BCryptPasswordEncoder();
      }
  
      @Bean
      public DaoAuthenticationProvider authenticationProvider() {
          DaoAuthenticationProvider authenticationProvider = new DaoAuthenticationProvider();
          authenticationProvider.setUserDetailsService(userDetailsService);
          authenticationProvider.setPasswordEncoder(passwordEncoder());
          return authenticationProvider;
      }
  
      @Bean
      public PersistentTokenBasedRememberMeServices getPersistentTokenBasedRememberMeServices() {
          PersistentTokenBasedRememberMeServices tokenBasedservice = new PersistentTokenBasedRememberMeServices(
              "remember-me", userDetailsService, tokenRepository);
          return tokenBasedservice;
      }
  
      @Bean
      public AuthenticationTrustResolver getAuthenticationTrustResolver() {
          return new AuthenticationTrustResolverImpl();
      }
  }
  </code></pre>