title: j_spring_security_check HTTP Status 404 (Custom Login)
body: <p>I am using Spring 4 + Hibernate 4. I checked every articles. but I could not find out what is the problem:
  <br>
  Web.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"&gt;
  
      &lt;!-- The definition of the Root Spring Container shared by all Servlets 
          and Filters --&gt;
      &lt;context-param&gt;
          &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
          &lt;param-value&gt;/WEB-INF/spring/root-context.xml, /WEB-INF/spring/appSecurity/spring-security.xml&lt;/param-value&gt;
      &lt;/context-param&gt;
  
      &lt;!-- Creates the Spring Container shared by all Servlets and Filters --&gt;
      &lt;listener&gt;
          &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
      &lt;/listener&gt;
  
      &lt;!-- Processes application requests --&gt;
      &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/appServlet/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;/&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;/*&lt;/url-pattern&gt;
      &lt;/filter-mapping&gt;
  
  &lt;/web-app&gt;
  </code></pre>
  
  <p>spring-security.xml</p>
  
  <pre><code>&lt;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"
      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.xsd"&gt;
  
      &lt;!-- enable use-expressions --&gt;
      &lt;http auto-config="true" use-expressions="true"&gt;
          &lt;intercept-url pattern="/panel/**"
              access="hasAnyRole('ROLE_USER', 'ROLE_ADMIN')" /&gt;
          &lt;intercept-url pattern="/admin/**" access="hasRole('ROLE_ADMIN')" /&gt;
  
          &lt;!-- access denied page --&gt;
          &lt;access-denied-handler error-page="/403" /&gt;
  
          &lt;form-login login-page="/login" default-target-url="/"
              authentication-failure-url="/login?error" username-parameter="username"
              password-parameter="password" /&gt;
          &lt;logout logout-success-url="/login?logout" /&gt;
  
          &lt;!-- enable csrf protection --&gt;
          &lt;csrf /&gt;
      &lt;/http&gt;
  
      &lt;authentication-manager&gt;
          &lt;authentication-provider&gt;
              &lt;jdbc-user-service data-source-ref="dataSource"
                  users-by-username-query="select username,password,enabled from users where username=?"
                  authorities-by-username-query="select u1.username, u2.role from users u1, user_roles u2 where u1.role_id = u2.role_id and u1.username =?" /&gt;
          &lt;/authentication-provider&gt;
      &lt;/authentication-manager&gt;
  
  &lt;/beans:beans&gt;
  </code></pre>
  
  <p>login.jsp</p>
  
  <pre><code>&lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1"
      pageEncoding="ISO-8859-1"%&gt;
  &lt;%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%&gt;
  &lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt;
  &lt;title&gt;Login&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;form action="&lt;c:url value='/j_spring_security_check' /&gt;" method='POST'&gt;
  
          &lt;table&gt;
              &lt;tr&gt;
                  &lt;td&gt;User:&lt;/td&gt;
                  &lt;td&gt;&lt;input type='text' name='username' value=''&gt;&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td&gt;Password:&lt;/td&gt;
                  &lt;td&gt;&lt;input type='password' name='password' /&gt;&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td colspan='2'&gt;&lt;input name="submit" type="submit"
                      value="submit" /&gt;&lt;/td&gt;
              &lt;/tr&gt;
          &lt;/table&gt;
  
          &lt;input type="hidden" name="${_csrf.parameterName}"
              value="${_csrf.token}" /&gt;
  
      &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>When I want to login the url is <code>localhost:8080/App/j_spring_security_check</code>and I get 404 error.<br>
  Could somebody explain that what is the problem?</p>