Ainda não tem acesso? Estude com a gente! Matricule-se
Ainda não tem acesso? Estude com a gente! Matricule-se

The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.

N

package br.com.caelum.contas.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 logica mvc");
        return "ok";
    }

}
13:30:02,752  INFO DispatcherServlet:479 - FrameworkServlet 'spring mvc': initialization started
13:30:02,799  INFO XmlWebApplicationContext:513 - Refreshing WebApplicationContext for namespace 'spring mvc-servlet': startup date [Tue Nov 05 13:30:02 BRT 2019]; root of context hierarchy
13:30:02,878  INFO XmlBeanDefinitionReader:316 - Loading XML bean definitions from ServletContext resource [/WEB-INF/spring-context.xml]
13:30:04,016  INFO RequestMappingHandlerMapping:197 - Mapped "{[/tabelas],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String br.com.caelum.contas.controller.InfraController.criaBanco() throws java.sql.SQLException
13:30:04,017  INFO RequestMappingHandlerMapping:197 - Mapped "{[/olaMundoSpring],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String br.com.caelum.contas.controller.OlaMundoController.execute()
13:30:04,500  INFO DispatcherServlet:498 - FrameworkServlet 'spring mvc': initialization completed in 1744 ms
Executando logica mvc

insira seu código aqui

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
  <display-name>contas</display-name>
  <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>

    <!-- Declaracao do servlet do Spring MVC abaixo-->
    <servlet>
        <servlet-name>spring mvc</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>
    </servlet>

    <servlet-mapping>
        <servlet-name>spring mvc</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>
</web-app>

o console do tomcat, o programa roda normalmente, mas quando faço a requisição no browser, " The origin server did not find a current representation for the target resource or is not willing to disclose that one exists. " Acontece o erro 404

1 resposta

Oi Thiago

Esse erro é por conta de você não ter criado o arquivo ok.jsp dentro de WebContent > WEB-INF > views > ok.jsp