title: spring security http 404 error
body: <p>For learning purposes I simple Spring-hibernate application. It has one-to-many db associations, where you can add a Warehouse and for each warehouse you can add items. Now I wanted to add spring-security for authentification but when I try to access the site, I get the HTTP ERROR 404.</p>
  
  <p>Here is spring-security par in web.xml:</p>
  
  <pre><code>&lt;context-param&gt;
     &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
     &lt;param-value&gt;
          /WEB-INF/spring-security.xml
     &lt;/param-value&gt;
  &lt;/context-param&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;
  </code></pre>
  
  <p>Here is 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-3.1.xsd"&gt;
  
      &lt;http use-expressions="true"&gt;
          &lt;intercept-url pattern="/record/**" access="permitAll" /&gt;
          &lt;form-login /&gt;
      &lt;/http&gt;
  
      &lt;authentication-manager&gt;
          &lt;authentication-provider&gt;
              &lt;user-service&gt;
                  &lt;user name="admin" password="password" authorities="supervisor, teller, user" /&gt;
                  &lt;user name="dianne" password="emu" authorities="teller, user" /&gt;
                  &lt;user name="scott" password="wombat" authorities="user" /&gt;
                  &lt;user name="peter" password="opal" authorities="user" /&gt;
              &lt;/user-service&gt;
          &lt;/authentication-provider&gt;
      &lt;/authentication-manager&gt;
  &lt;/beans:beans&gt;
  </code></pre>
  
  <p>If I change the <code>access="permitAll"</code> to `access="hasRole('supervisor')" When I try to access the application, I am asked to enter the username and password, but when I enter them, I also get the 404 error. Without spring-security the app works fine when I acces "http://localhost:8080/testapp/record/list" ...
  I used this site to learn about spring security - <a href="http://static.springsource.org/spring-security/site/tutorial.html" rel="nofollow">http://static.springsource.org/spring-security/site/tutorial.html</a></p>
  
  <p>Here is my MainController:</p>
  
  <pre><code>@Controller
  @RequestMapping("/record")
  public class MainController {
  
      protected static Logger logger = Logger.getLogger("controller");
  
      @Resource(name="warehouseService")
       private WarehouseService warehouseService;
  
       @Resource(name="itemService")
       private ItemService itemService;
  
          @RequestMapping(value = "/list", method = RequestMethod.GET)
          public String getRecords(Model model) {
           logger.debug("Received request to show records page");
  
           // Retrieve all persons
           List&lt;Warehouse&gt; warehouses = warehouseService.getAll();
  
           // Prepare model object
           List&lt;WarehouseDTO&gt; warehousesDTO = new ArrayList&lt;WarehouseDTO&gt;();
  
           for (Warehouse warehouse: warehouses) {
            // Create new data transfer object
               WarehouseDTO dto = new WarehouseDTO();
  
         dto.setId(warehouse.getId());
         dto.setName(warehouse.getName());
         dto.setAddress(warehouse.getAddress());
         dto.setManager(warehouse.getManager());
         dto.setItems(itemService.getAll(warehouse.getId()));
  
         warehousesDTO.add(dto);
           }
  
           model.addAttribute("warehouses", warehousesDTO);
  
        return "records";
       }
  </code></pre>
  
  <p>Any ideas?</p>