2
respostas

HTTP Status 404 – Não Encontrado

Olá,

Meu código está exatamente como no vídeo, mas não consigo fazer o primeiro acesso ao http://localhost:8080/jsf-livraria/livro.xhtml, pois recebo o erro HTTP Status 404 – Não Encontrado.

Segue meu livro.xhtml:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
        xmlns:h="http://java.sun.com/jsf/html">

    <h:body>
        <h:form>
            <h:inputText />
            <h:commandButton value="Gravar" />
        </h:form>
    </h:body>        

</html>

Segue meu web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd" version="4.0">
  <display-name>jsf-livraria</display-name>
  <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.xhtml</url-pattern>
  </servlet-mapping>
</web-app>

As diferenças são que estou usando as versões:

  • javax.faces-2.3.2.jar;
  • tomcat v9.0
2 respostas

Estava recebendo o erro Unable to find CDI BeanManager no console. Troquei a versão do JSF para a provida nos slides (2.1.14) e resolveu.

Oi Murilo,

Conseguiu resolver o problema então?

Abraço!