Boa tarde pessoal,
Estou tentando resolver o exercício 11.6 da fj21 da Caelum, mas dá erro 404:
HTTP Status 404 - /fj21-tarefas/olaMundoSpring
type Status report
message /fj21-tarefas/olaMundoSpring
description The requested resource (/fj21-tarefas/olaMundoSpring) is not available.
Sendo que no tomcat não gera erro algum no log.
Tô nisso desde ontem, e nada de funcionar.
To com o arquivo de conf do Spring assim (spring-context.xml):
[code]<?xml version="1.0" encoding="UTF-8"?>
<context:component-scan base-package=“br.com.caelum.tarefas.controller” />
<mvc:annotation-driven /> <mvc:resources mapping="/resources/**" location="/resources/" />
[/code]
Meu web.xml
[code]<?xml version="1.0" encoding="UTF-8"?>
fj21-tarefas
<servlet>
<servlet-name>springmvc</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring-context.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>springmvc</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<filter>
<filter-name>FiltroConexao</filter-name>
<filter-class>br.com.caelum.tarefas.filtro.FiltroConexao</filter-class>
</filter>
<filter-mapping>
<filter-name>FiltroConexao</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
[/code]
A classe OlaMundoController:
[code]package br.com.caelum.tarefas.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class OlaMundoController {
@RequestMapping("/olaMundoSpring")
public String execute() {
System.out.println("Executando a lógica com Spring MVC");
return "ok";
}
}[/code]
E a view ok.jsp em WEB-INF/views
[code]<%@ page language=“java” contentType=“text/html; charset=ISO-8859-1”
pageEncoding=“ISO-8859-1”%>
Olá mundo com Spring MVC!
[/code]O tomcat tá funcionando perfeitamente, nem imagino o porque de não estar funcionando se estou seguindo a apostila.
Se alguem puder dar uma ajuda.
Muito obrigado desde já.
Abraços.