1
resposta

HTTP Status 404 – Not Found

Efetuei o passo a passo e no entanto não estou conseguindo executar a código, instalei a versão 7 do tomcat, efetuei a configuração conforme o vídeo, além disso há alguns arquivos exibidos com ícone vermelho.

No aguardo,

<? xml version="1.0" encoding="UTF-8" ?>
<!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>
<?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" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.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>
1 resposta

Consegui fazer funcionar o tomcat, precisei alterar a porta 8080. No entanto agora estou com outro problema.

HTTP Status 500 – Internal Server Error
Type Exception Report

Message Error Parsing /livro.xhtml: Error Traced[line: 1] The processing instruction must begin with the name of the target.

Description The server encountered an unexpected condition that prevented it from fulfilling the request.

Exception

javax.servlet.ServletException: Error Parsing /livro.xhtml: Error Traced[line: 1] The processing instruction must begin with the name of the target.
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:606)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
Root Cause

javax.faces.view.facelets.FaceletException: Error Parsing /livro.xhtml: Error Traced[line: 1] The processing instruction must begin with the name of the target.
    com.sun.faces.facelets.compiler.SAXCompiler.doCompile(SAXCompiler.java:427)
    com.sun.faces.facelets.compiler.SAXCompiler.doMetadataCompile(SAXCompiler.java:410)
    com.sun.faces.facelets.compiler.Compiler.metadataCompile(Compiler.java:130)
    com.sun.faces.facelets.impl.DefaultFaceletFactory.createMetadataFacelet(DefaultFaceletFactory.java:326)
    com.sun.faces.facelets.impl.DefaultFaceletFactory.access$200(DefaultFaceletFactory.java:92)
    com.sun.faces.facelets.impl.DefaultFaceletFactory$2.newInstance(DefaultFaceletFactory.java:165)
    com.sun.faces.facelets.impl.DefaultFaceletFactory$2.newInstance(DefaultFaceletFactory.java:163)
    com.sun.faces.facelets.impl.DefaultFaceletCache$2.newInstance(DefaultFaceletCache.java:94)
    com.sun.faces.facelets.impl.DefaultFaceletCache$2.newInstance(DefaultFaceletCache.java:89)
    com.sun.faces.util.ExpiringConcurrentCache$1.call(ExpiringConcurrentCache.java:99)
    java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    com.sun.faces.util.ExpiringConcurrentCache.get(ExpiringConcurrentCache.java:114)
    com.sun.faces.facelets.impl.DefaultFaceletCache.getViewMetadataFacelet(DefaultFaceletCache.java:143)
    com.sun.faces.facelets.impl.DefaultFaceletCache.getViewMetadataFacelet(DefaultFaceletCache.java:62)
    com.sun.faces.facelets.impl.DefaultFaceletFactory.getMetadataFacelet(DefaultFaceletFactory.java:259)
    com.sun.faces.facelets.impl.DefaultFaceletFactory.getMetadataFacelet(DefaultFaceletFactory.java:208)
    com.sun.faces.application.view.ViewMetadataImpl.createMetadataView(ViewMetadataImpl.java:113)
    com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:233)
    com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:116)
    com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
Note The full stack trace of the root cause is available in the server logs.