When mapping an Exception to 404 page, the Spring Security tags can\'t find the authentication information from the security context. With a \"real\" 404 the authentication is f
The most probable case is that some component in your code is calling HttpSession.invalidate()
while exception handling. You can easily find this out by a simple debugging.
But actually it is not necessary to check for isAnonymous()
- it is enough to check for user not having ROLE_USER
authority:
areNotGranted
attribute of
tag (see Spring Security 2 documentationaccess="!hasRole('ROLE_USER')"