title: Spring 3 Security j_spring_security_check
body: <p>I'm trying to learn, how spring security works, so I've downloaded some sample project and then I tried to implement that solution to my project. But when I try to login, I get <code>404</code> error and in an address bar I have <code>http://localhost:8080/fit/j_spring_security_check</code>. I tried to look at similar questions here, but I wasn't able to realize, how to apply it to my project. I'd be really thankful, if somebody, who is more experienced, could help me.</p>
  
  <p>My app structure looks like this:</p>
  
  <p><img src="https://i.stack.imgur.com/x2X1t.png" alt="enter image description here"></p>
  
  <p>applicationContext.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xmlns:context="http://www.springframework.org/schema/context"
     xmlns:security="http://www.springframework.org/schema/security"
     xsi:schemaLocation="
      http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
      http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
      http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd"&gt;
  
  &lt;context:annotation-config/&gt;
  
  &lt;context:component-scan base-package="cz.cvut.fit"/&gt;
  
  &lt;import resource="classpath:applicationContext-security.xml"/&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>applicationContext-web.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xmlns:mvc="http://www.springframework.org/schema/mvc"
     xmlns:context="http://www.springframework.org/schema/context"
     xmlns:security="http://www.springframework.org/schema/security"
     xsi:schemaLocation="
      http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
      http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
      http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
      http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd"&gt;
  
  &lt;context:annotation-config/&gt;
  
  &lt;context:component-scan base-package="cz.cvut.fit" /&gt;
  
  &lt;mvc:annotation-driven /&gt;
  
  &lt;security:global-method-security jsr250-annotations="enabled"
                                   proxy-target-class="true"/&gt;
  &lt;/beans&gt;
  </code></pre>
  
  <p>applicationContext-security.xml:</p>
  
  <pre><code>&lt;beans xmlns:security="http://www.springframework.org/schema/security"
     xmlns="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.1.xsd"&gt;
  
  &lt;security:http pattern="/css/**" security="none"/&gt;
  &lt;security:http pattern="/views/login.jsp*" security="none"/&gt;
  &lt;security:http pattern="/views/denied.jsp" security="none"/&gt;
  
  &lt;security:http auto-config="true" access-denied-page="/denied.jsp" servlet-api-provision="false"&gt;
      &lt;security:intercept-url pattern="/views/login.jsp*" access="IS_AUTHENTICATED_ANONYMOUSLY"/&gt;
      &lt;security:intercept-url pattern="/views/edit/**" access="ROLE_EDIT"/&gt;
      &lt;security:intercept-url pattern="/views/admin/**" access="ROLE_ADMIN"/&gt;
      &lt;security:intercept-url pattern="/**" access="ROLE_USER"/&gt;
      &lt;security:form-login login-page="/views/login.jsp" authentication-failure-url="/denied.jsp"
                           default-target-url="/home.jsp"/&gt;
      &lt;security:logout/&gt;
  &lt;/security:http&gt;
  
  &lt;security:authentication-manager&gt;
      &lt;security:authentication-provider&gt;
          &lt;security:user-service&gt;
              &lt;security:user name="adam" password="adampassword" authorities="ROLE_USER"/&gt;
              &lt;security:user name="jane" password="janepassword" authorities="ROLE_USER, ROLE_ADMIN"/&gt;
              &lt;security:user name="sue" password="suepassword" authorities="ROLE_USER, ROLE_EDIT"/&gt;
          &lt;/security:user-service&gt;
      &lt;/security:authentication-provider&gt;
  &lt;/security:authentication-manager&gt;
  
  &lt;/beans&gt;
  </code></pre>