Boa tarde, estou implementando um projeto utilizando Spring 3 MVC e Spring Security, mas estou recebendo um erro 404 quando tento chamar a página de login. A mensagem no console é:
Mai 31, 2012 5:48:09 PM org.springframework.web.servlet.DispatcherServlet noHandlerFound
Advertência: No mapping found for HTTP request with URI [/MeuApp/WEB-INF/jsp/login.jsp] in DispatcherServlet with name 'spring'
<context:annotation-config />
<context:component-scan base-package="br.com.anhambi.nfemanager" />
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsp/"/>
<property name="suffix" value=".jsp"/>
</bean>
<import resource="spring-database.xml" />
<sec:http auto-config="true" use-expressions="true" access-denied-page="/auth/denied" >
<sec:intercept-url pattern="/admin/**" access="hasRole('ROLE_ADMIN')"/>
<sec:intercept-url pattern="/manager/**" access="hasRole('ROLE_ADMIN')"/>
<sec:intercept-url pattern="/cnpj/**" access="hasRole('ROLE_ADMIN')"/>
<sec:form-login
login-page="/auth/login"
authentication-failure-url="/auth/login?error=true"
default-target-url="/cnpj"/>
<sec:logout
invalidate-session="true"
logout-success-url="/auth/login"
logout-url="/auth/logout"/>
</sec:http>
<!-- Declare an authentication-manager to use a custom userDetailsService -->
<sec:authentication-manager>
<sec:authentication-provider user-service-ref="customUserDetailsService" />
</sec:authentication-manager>
<!-- A custom service where Spring will retrieve users and their corresponding access levels -->
<bean id="customUserDetailsService" class="br.com.anhambi.nfemanager.service.CustomUserDetailsService"/>
@Transactional(readOnly = true)
public class CustomUserDetailsService implements UserDetailsService {
@Autowired
private UserDAO userDAO;
@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException, DataAccessException {
UserVO user = null;
try {
user = userDAO.autenticar(username);
} catch (Exception e) {
throw new UsernameNotFoundException("Error in retrieving user");
}
return user;
}
}
@Controller
@RequestMapping("/auth")
public class AuthenticationController {
@RequestMapping(value = "/login", method = RequestMethod.GET)
public String getLoginPage(@RequestParam(value="error", required=false) boolean error, ModelMap model) {
/*ModelAndView modelAndView = new ModelAndView("login");
if (error) {
modelAndView.addObject("mensagem", "Deu pau!");
}
return modelAndView;*/
return "login";
}
@RequestMapping(value = "/denied", method = RequestMethod.GET)
public String getDeniedPage() {
return "denied";
}
}
O arquivo login.jsp está salvo dentro do diretório /WEB-INF/jsp/login.jsp.
No browser está aparecendo esta mensagem:
HTTP Status 404 -
type Status report
message
description The requested resource () is not available.
Apache Tomcat/7.0.22
Será que alguém pode me ajudar?