Solucionado (ver solução)
Solucionado
(ver solução)
4
respostas

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

Pessoal já limpei meu projeto, já criei de novo, já desativei e ativei o build automatico do eclipse e continuo com o mesmo erro quando tento executar uma pagina que traz uma lista.

No meu console não traz nenhum erro somente no navegador

4 respostas
package br.com.rhsolucao.controllers;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import br.com.rhsolucao.daos.FuncionarioDAO;
import br.com.rhsolucao.models.Funcionario;

@Controller
@RequestMapping("/funcionarios")
public class FuncionariosController {

    @Autowired
    private FuncionarioDAO funcionarioDAO;

    @RequestMapping("/form")
    public String form() {
        return "funcionarios/form";
    }

    @RequestMapping(method = RequestMethod.POST)
    public String gravar(Funcionario funcionario) {

        System.out.println(funcionario);
        funcionarioDAO.gravar(funcionario);
        return "funcionarios/ok";
    }

    @RequestMapping(method = RequestMethod.GET)
    public ModelAndView listar() {
        List<Funcionario> funcionarios = funcionarioDAO.listar();
        ModelAndView view = new ModelAndView("funcionarios/lista");
        view.addObject("funcionarios", funcionarios);
        return view;
    }


}
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.rhsolucao</groupId>
    <artifactId>rhsolucao</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <packaging>war</packaging>
    <build>
        <finalName>rhsolucao</finalName>
    </build>

    <dependencies>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>4.1.0.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.apache.tomcat</groupId>
            <artifactId>tomcat-servlet-api</artifactId>
            <version>7.0.30</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet.jsp</groupId>
            <artifactId>jsp-api</artifactId>
            <version>2.1</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet.jsp.jstl</groupId>
            <artifactId>jstl-api</artifactId>
            <version>1.2</version>
            <exclusions>
                <exclusion>
                    <groupId>javax.servlet</groupId>
                    <artifactId>servlet-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.glassfish.web</groupId>
            <artifactId>jstl-impl</artifactId>
            <version>1.2</version>
            <exclusions>
                <exclusion>
                    <groupId>javax.servlet</groupId>
                    <artifactId>servlet-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.6.1</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jcl-over-slf4j</artifactId>
            <version>1.6.1</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>1.6.1</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.16</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <version>4.3.0.Final</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>4.3.0.Final</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate.javax.persistence</groupId>
            <artifactId>hibernate-jpa-2.1-api</artifactId>
            <version>1.0.0.Final</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-orm</artifactId>
            <version>4.1.0.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.15</version>
        </dependency>

    </dependencies>

    <properties>
        <failOnMissingWebXml>false</failOnMissingWebXml>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
</project>

Oi Clinton,

Parece ser um erro de configuração.

Poste aqui as suas classes de configuração do Spring.

solução!

Bom dia,

Rodrigo obrigado pelo retorno, descobri o que se tratava o erro, algo bem ridiculo, tenho dois metodos que retornam que no request atendem com o mesmo nome porém um retorna um get e outro faz um post

 @RequestMapping(method = RequestMethod.POST)
    public String gravar(Funcionario funcionario) {

        System.out.println(funcionario);
        funcionarioDAO.gravar(funcionario);
        return "funcionarios/ok";
    }

    @RequestMapping(method = RequestMethod.GET)
    public ModelAndView listar() {
        List<Funcionario> funcionarios = funcionarioDAO.listar();
        ModelAndView view = new ModelAndView("funcionarios/lista");
        view.addObject("funcionarios", funcionarios);
        return view;
    }

No metodo que faz o GET eu estava buscando da seguinte forma

http://localhost:8080/rhsolucao/funcionarios/lista

o correto é http://localhost:8080/rhsolucao/funcionarios

Um erro bem besta