title: spring security 4.0.1 - HTTP Status 405 - Request method 'POST' not supported
body: <p>I am using Spring MVC (4.1.6 RELEASE) and Spring Security (4.0.1 RELEASE).</p>
  
  <p>When i am trying to submit my login form ,i am getting "HTTP Status 405 - Request method 'POST' not supported ." Error.</p>
  
  <p>web.xml</p>
  
  <pre><code>&lt;context-param&gt;
      &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
      &lt;param-value&gt;classpath:/jpaContext.xml&lt;/param-value&gt;
  &lt;/context-param&gt;
  &lt;context-param&gt;
      &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
      &lt;param-value&gt;/WEB-INF/config/security-config.xml&lt;/param-value&gt;
  &lt;/context-param&gt;
  &lt;listener&gt;
      &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
  &lt;/listener&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;servlet&gt;
      &lt;servlet-name&gt;ISMServlet&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/config/servlet-config.xml&lt;/param-value&gt;
      &lt;/init-param&gt;
  &lt;/servlet&gt;
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;ISMServlet&lt;/servlet-name&gt;
      &lt;url-pattern&gt;*.html&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  </code></pre>
  
  <p>spring-security.xml</p>
  
  <pre><code>&lt;context:annotation-config /&gt;
  &lt;context:component-scan  base-package="com.sam"/&gt;
  
  &lt;security:http auto-config='true' &gt;    
      &lt;security:intercept-url pattern="/index.jsp" access="permitAll" /&gt;
      &lt;security:intercept-url pattern="/login.html" access="permitAll" /&gt;
      &lt;security:intercept-url pattern="/**" access="hasRole('USER')" /&gt;
      &lt;security:access-denied-handler error-page="/403.html"/&gt;
      &lt;security:form-login login-page="/login.html"   authentication-failure-url="/error.html" default-target-url="/home.html" /&gt; 
      &lt;security:logout logout-success-url="/index.jsp" delete-cookies="JSESSIONID"/&gt;
  &lt;/security:http&gt;
  
  &lt;security:authentication-manager&gt;
      &lt;security:authentication-provider&gt;
          &lt;security:password-encoder hash="bcrypt" /&gt;
          &lt;security:jdbc-user-service data-source-ref="dataSource" /&gt;
      &lt;/security:authentication-provider&gt;
  &lt;/security:authentication-manager&gt;
  
  &lt;bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"&gt;
      &lt;property name="driverClassName" value="com.mysql.jdbc.Driver" /&gt;
      &lt;property name="url" value="jdbc:mysql://localhost:3306/ism" /&gt;
      &lt;property name="username" value="root" /&gt;
      &lt;property name="password" value="" /&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>form.html</p>
  
  <pre><code>&lt;form  action="j_spring_security_check" name="f" method="post" &gt;
  
              &lt;input name="j_username" type="text" /&gt;
              &lt;input name="j_password" type="password"/&gt;
              &lt;input name="submit" id="button" type="submit" value="enter" /&gt;
      &lt;/form&gt;
  </code></pre>