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

configuracao de ambiente e primeiros passos jsf

fiz neh e a pag nao da certo?
n consigo achar o erro 
no navegador ta esse erro


HTTP Status 500 - Servlet.init() for servlet Faces Servlet threw exception

type Exception report

message Servlet.init() for servlet Faces Servlet threw exception

description The server encountered an internal error that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Servlet.init() for servlet Faces Servlet threw exception
    org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
    org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
    org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
    org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314)
    java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    java.lang.Thread.run(Unknown Source)
root cause

java.lang.IllegalStateException: Could not find backup for factory javax.faces.context.FacesContextFactory. 
    javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.java:1135)
    javax.faces.FactoryFinder.getFactory(FactoryFinder.java:379)
    javax.faces.webapp.FacesServlet.init(FacesServlet.java:350)
    org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
    org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
    org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
    org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314)
    java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    java.lang.Thread.run(Unknown Source)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.54 logs.

Apache Tomcat/7.0.54
32 respostas

olá Gustavo

Esse tipo de erro acontece quando há mais de uma versão do JSF no classpath. Que jars você tem na sua aplicação?

2.2

2.2. ate tentei criar um novo projeto e nada . mesmo erro...

mas no geral so uma versao no classpath

Ok, pela exception você ta usando o tomcat né? Poderia postar seu web.xml?

sim vamos la
<?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>livraria-jsf</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>`

`

Nada de mais no seu web.xml. Pedi pra ver pois se alguma configurações estivesse duplicada também poderia causar erros.

Consegue colocar o seu projeto no dropbox e me mandar o link por email ( mario.amaral@caelum.com.br )? Não consigo imaginar o que mais poderia ser, precisaria olhar com calma pra achar o problema.

ok ta mandei ve se eh isso?

Olhando seu print, me parece que está faltando jars no seu projeto. Vejo que você tem o JSF APi, mas não tem o JSF impl. O jar que é pedido no vídeo (http://s3.amazonaws.com/caelum-online-public/JSF/javax.faces-2.1.14.jar) é uma compilação desses dois, jsf-api e jsf-impl. Tente baixar desse link aqui e troque o jar do seu projeto.

kra segui a video aula no capitulo 2. eh realmente eu instalei esse e ai deu erro ai entrei no site e baixei o 2.2 outra coisa. o video ja ta desatualizado a pag para baixar o jar ta desatualizada

e ai como faço?

segui a video aula...

baixe daqui: https://maven.java.net/content/repositories/releases/org/glassfish/javax.faces/2.2.7/javax.faces-2.2.7.jar.

Você pode acahr as ultimas versões sempre nesse site: https://javaserverfaces.java.net/2.2/download.html

Teste ai e me diga se deu certo.

fui isso mesmo que eu fiz. mas tudo bem faço de novo. lembrando cheguei a instala o 2.1 q vc flw antes ta?

baixei pelo link que vc flw. copiei pra pasta lib restartei o apache e deu esse erro

HTTP Status 500 - Error Parsing /livro.xhtml: Error Traced[line: 5] O prefixo "h" do elemento "h:body" não está vinculado.

type Exception report

message Error Parsing /livro.xhtml: Error Traced[line: 5] O prefixo "h" do elemento "h:body" não está vinculado.

description The server encountered an internal error that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Error Parsing /livro.xhtml: Error Traced[line: 5] O prefixo "h" do elemento "h:body" não está vinculado.
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:659)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
root cause

javax.faces.view.facelets.FaceletException: Error Parsing /livro.xhtml: Error Traced[line: 5] O prefixo "h" do elemento "h:body" não está vinculado.
    com.sun.faces.facelets.compiler.SAXCompiler.doCompile(SAXCompiler.java:456)
    com.sun.faces.facelets.compiler.SAXCompiler.doMetadataCompile(SAXCompiler.java:439)
    com.sun.faces.facelets.compiler.Compiler.metadataCompile(Compiler.java:130)
    com.sun.faces.facelets.impl.DefaultFaceletFactory.createMetadataFacelet(DefaultFaceletFactory.java:503)
    com.sun.faces.facelets.impl.DefaultFaceletFactory.access$200(DefaultFaceletFactory.java:106)
    com.sun.faces.facelets.impl.DefaultFaceletFactory$2.newInstance(DefaultFaceletFactory.java:205)
    com.sun.faces.facelets.impl.DefaultFaceletFactory$2.newInstance(DefaultFaceletFactory.java:203)
    com.sun.faces.facelets.impl.DefaultFaceletCache$2.newInstance(DefaultFaceletCache.java:97)
    com.sun.faces.facelets.impl.DefaultFaceletCache$2.newInstance(DefaultFaceletCache.java:92)
    com.sun.faces.util.ExpiringConcurrentCache$1.call(ExpiringConcurrentCache.java:99)
    java.util.concurrent.FutureTask.run(Unknown Source)
    com.sun.faces.util.ExpiringConcurrentCache.get(ExpiringConcurrentCache.java:114)
    com.sun.faces.facelets.impl.DefaultFaceletCache.getViewMetadataFacelet(DefaultFaceletCache.java:146)
    com.sun.faces.facelets.impl.DefaultFaceletCache.getViewMetadataFacelet(DefaultFaceletCache.java:63)
    com.sun.faces.facelets.impl.DefaultFaceletFactory.getMetadataFacelet(DefaultFaceletFactory.java:316)
    com.sun.faces.facelets.impl.DefaultFaceletFactory.getMetadataFacelet(DefaultFaceletFactory.java:246)
    com.sun.faces.application.view.ViewMetadataImpl.createMetadataView(ViewMetadataImpl.java:138)
    com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:241)
    com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:121)
    com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:646)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.54 logs.

Apache Tomcat/7.0.54

Agora o JSF subiu, mas vc tem um erro no seu livro.xhtml:

Error Parsing /livro.xhtml: Error Traced[line: 5] O prefixo "h" do elemento "h:body" não está vinculado.

Poste o seu livro.xhtml.

baixei o arquivo do link https://maven.java.net/content/repositories/releases/org/glassfish/javax.faces/2.2.7/javax.faces-2.2.7.jar. copiei pra pasta lib

<?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>
    <h1>Novo Livro</h1>
    <h:form>
    <fieldset>
        <legend>Dados do Livro</legend>
        <h:panelGrid columns="2">
    <h:outputLabel value="Titulo:" for="titulo"/>
    <h:inputText id="titulo" value="#{livroBean.titulo}" />
    <h:outputLabel value="ISBN:" for="isbn"/>
    <h:inputText id="isbn" value="#{livroBean.isbn}"/>
    <h:outputLabel value="Preço:" for="preco"/>
    <h:inputText id="preco" value="#{livroBean.preco}"/>
    <h:outputLabel value="Date de lancamento:" for="dataLancamento"/>
    <h:inputText id="dataLancamento" value="#{livroBean.dataLancamento}"/>
        <h:commandButton value ="Gravar" action="#{livroBean.gravar}"/>
        </h:panelGrid>
        </fieldset>
    </h:form>
</h:body>






</html>

tem um erro na linha 3 do seu arquivo. troque:

<html xmlns="http://www.w3.org/1999/xhtml">

por

<html xmlns="http://www.w3.org/1999/xhtml"

após isso deve funcionar.

vai fica a mesma coisa , num vai nao?

Não, são diferentes.

Se você reparar, eu removi o último caractere, um >, que estava fechando a tag html antes da hora, por isso seu código não funciona.

Jul 21, 2014 10:44:31 PM org.apache.catalina.core.AprLifecycleListener init
Informações: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre7\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Java\jdk1.7.0_55\bin;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;c:\hsqldb\hsqldb.jar;.
Jul 21, 2014 10:44:32 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
Advertência: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:livraria-jsf' did not find a matching property.
Jul 21, 2014 10:44:33 PM org.apache.coyote.AbstractProtocol init
Informações: Initializing ProtocolHandler ["http-bio-8080"]
Jul 21, 2014 10:44:33 PM org.apache.coyote.AbstractProtocol init
Informações: Initializing ProtocolHandler ["ajp-bio-8009"]
Jul 21, 2014 10:44:33 PM org.apache.catalina.startup.Catalina load
Informações: Initialization processed in 5116 ms
Jul 21, 2014 10:44:33 PM org.apache.catalina.core.StandardService startInternal
Informações: Starting service Catalina
Jul 21, 2014 10:44:33 PM org.apache.catalina.core.StandardEngine startInternal
Informações: Starting Servlet Engine: Apache Tomcat/7.0.54
Jul 21, 2014 10:44:41 PM com.sun.faces.config.ConfigureListener contextInitialized
Informações: Inicializando Mojarra 2.2.7 ( 20140610-1547 https://svn.java.net/svn/mojarra~svn/tags/2.2.7@13362) para o contexto '/livraria-jsf'
Jul 21, 2014 10:44:43 PM com.sun.faces.spi.InjectionProviderFactory createInstance
Informações: JSF1048: Anotações PostConstruct/PreDestroy presentes.  Os métodos ManagedBeans marcados com essas anotações informarão as anotações processadas.
Jul 21, 2014 10:44:46 PM org.apache.catalina.util.SessionIdGenerator createSecureRandom
Informações: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [189] milliseconds.
Jul 21, 2014 10:44:46 PM org.apache.coyote.AbstractProtocol start
Informações: Starting ProtocolHandler ["http-bio-8080"]
Jul 21, 2014 10:44:46 PM org.apache.coyote.AbstractProtocol start
Informações: Starting ProtocolHandler ["ajp-bio-8009"]
Jul 21, 2014 10:44:46 PM org.apache.catalina.startup.Catalina start
Informações: Server startup in 13075 ms
Jul 21, 2014 10:46:03 PM com.sun.faces.lifecycle.ProcessValidationsPhase execute
Advertência: /livro.xhtml @13,57 value="#{livroBean.titulo}": Target Unreachable, identifier 'livroBean' resolved to null
javax.el.PropertyNotFoundException: /livro.xhtml @13,57 value="#{livroBean.titulo}": Target Unreachable, identifier 'livroBean' resolved to null
    at com.sun.faces.facelets.el.TagValueExpression.getType(TagValueExpression.java:100)
    at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getConvertedValue(HtmlBasicInputRenderer.java:95)
    at javax.faces.component.UIInput.getConvertedValue(UIInput.java:1045)
    at javax.faces.component.UIInput.validate(UIInput.java:975)
    at javax.faces.component.UIInput.executeValidate(UIInput.java:1248)
    at javax.faces.component.UIInput.processValidators(UIInput.java:712)
    at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1258)
    at javax.faces.component.UIForm.processValidators(UIForm.java:253)
    at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1258)
    at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1258)
    at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:1195)
    at com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:76)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Unknown Source)
Caused by: javax.el.PropertyNotFoundException: Target Unreachable, identifier 'livroBean' resolved to null
    at org.apache.el.parser.AstValue.getTarget(AstValue.java:97)
    at org.apache.el.parser.AstValue.getType(AstValue.java:81)
    at org.apache.el.ValueExpressionImpl.getType(ValueExpressionImpl.java:171)
    at com.sun.faces.facelets.el.TagValueExpression.getType(TagValueExpression.java:98)
    ... 34 more

Jul 21, 2014 10:46:03 PM org.apache.catalina.core.StandardWrapperValve invoke
Grave: Servlet.service() for servlet [Faces Servlet] in context with path [/livraria-jsf] threw exception [/livro.xhtml @13,57 value="#{livroBean.titulo}": Target Unreachable, identifier 'livroBean' resolved to null] with root cause
javax.el.PropertyNotFoundException: Target Unreachable, identifier 'livroBean' resolved to null
    at org.apache.el.parser.AstValue.getTarget(AstValue.java:97)
    at org.apache.el.parser.AstValue.getType(AstValue.java:81)
    at org.apache.el.ValueExpressionImpl.getType(ValueExpressionImpl.java:171)
    at com.sun.faces.facelets.el.TagValueExpression.getType(TagValueExpression.java:98)
    at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getConvertedValue(HtmlBasicInputRenderer.java:95)
    at javax.faces.component.UIInput.getConvertedValue(UIInput.java:1045)
    at javax.faces.component.UIInput.validate(UIInput.java:975)
    at javax.faces.component.UIInput.executeValidate(UIInput.java:1248)
    at javax.faces.component.UIInput.processValidators(UIInput.java:712)
    at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1258)
    at javax.faces.component.UIForm.processValidators(UIForm.java:253)
    at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1258)
    at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1258)
    at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:1195)
    at com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:76)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Unknown Source)
HTTP Status 500 - /livro.xhtml @13,57 value="#{livroBean.titulo}": Target Unreachable, identifier 'livroBean' resolved to null

type Exception report

message /livro.xhtml @13,57 value="#{livroBean.titulo}": Target Unreachable, identifier 'livroBean' resolved to null

description The server encountered an internal error that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: /livro.xhtml @13,57 value="#{livroBean.titulo}": Target Unreachable, identifier 'livroBean' resolved to null
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:659)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
root cause

javax.el.PropertyNotFoundException: /livro.xhtml @13,57 value="#{livroBean.titulo}": Target Unreachable, identifier 'livroBean' resolved to null
    com.sun.faces.facelets.el.TagValueExpression.getType(TagValueExpression.java:100)
    com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getConvertedValue(HtmlBasicInputRenderer.java:95)
    javax.faces.component.UIInput.getConvertedValue(UIInput.java:1045)
    javax.faces.component.UIInput.validate(UIInput.java:975)
    javax.faces.component.UIInput.executeValidate(UIInput.java:1248)
    javax.faces.component.UIInput.processValidators(UIInput.java:712)
    javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1258)
    javax.faces.component.UIForm.processValidators(UIForm.java:253)
    javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1258)
    javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1258)
    javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:1195)
    com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:76)
    com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:646)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
root cause

javax.el.PropertyNotFoundException: Target Unreachable, identifier 'livroBean' resolved to null
    org.apache.el.parser.AstValue.getTarget(AstValue.java:97)
    org.apache.el.parser.AstValue.getType(AstValue.java:81)
    org.apache.el.ValueExpressionImpl.getType(ValueExpressionImpl.java:171)
    com.sun.faces.facelets.el.TagValueExpression.getType(TagValueExpression.java:98)
    com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getConvertedValue(HtmlBasicInputRenderer.java:95)
    javax.faces.component.UIInput.getConvertedValue(UIInput.java:1045)
    javax.faces.component.UIInput.validate(UIInput.java:975)
    javax.faces.component.UIInput.executeValidate(UIInput.java:1248)
    javax.faces.component.UIInput.processValidators(UIInput.java:712)
    javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1258)
    javax.faces.component.UIForm.processValidators(UIForm.java:253)
    javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1258)
    javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1258)
    javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:1195)
    com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:76)
    com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:646)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.54 logs.

Apache Tomcat/7.

o stack nao ficou igual do video mostrando gravando. ficou assim:

Jul 21, 2014 10:57:36 PM org.apache.catalina.core.AprLifecycleListener init Informações: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre7\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Java\jdk1.7.0_55\bin;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;c:\hsqldb\hsqldb.jar;. Jul 21, 2014 10:57:36 PM org.apache.tomcat.util.digester.SetPropertiesRule begin Advertência: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:livraria-jsf' did not find a matching property. Jul 21, 2014 10:57:37 PM org.apache.coyote.AbstractProtocol init Informações: Initializing ProtocolHandler ["http-bio-8080"] Jul 21, 2014 10:57:37 PM org.apache.coyote.AbstractProtocol init Informações: Initializing ProtocolHandler ["ajp-bio-8009"] Jul 21, 2014 10:57:37 PM org.apache.catalina.startup.Catalina load Informações: Initialization processed in 3076 ms Jul 21, 2014 10:57:37 PM org.apache.catalina.core.StandardService startInternal Informações: Starting service Catalina Jul 21, 2014 10:57:37 PM org.apache.catalina.core.StandardEngine startInternal Informações: Starting Servlet Engine: Apache Tomcat/7.0.54 Jul 21, 2014 10:57:44 PM com.sun.faces.config.ConfigureListener contextInitialized Informações: Inicializando Mojarra 2.2.7 ( 20140610-1547 https://svn.java.net/svn/mojarra~svn/tags/2.2.7@13362) para o contexto '/livraria-jsf' Jul 21, 2014 10:57:45 PM com.sun.faces.spi.InjectionProviderFactory createInstance Informações: JSF1048: Anotações PostConstruct/PreDestroy presentes. Os métodos ManagedBeans marcados com essas anotações informarão as anotações processadas. Jul 21, 2014 10:57:48 PM org.apache.catalina.util.SessionIdGenerator createSecureRandom Informações: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [209] milliseconds. Jul 21, 2014 10:57:48 PM org.apache.coyote.AbstractProtocol start Informações: Starting ProtocolHandler ["http-bio-8080"] Jul 21, 2014 10:57:48 PM org.apache.coyote.AbstractProtocol start Informações: Starting ProtocolHandler ["ajp-bio-8009"] Jul 21, 2014 10:57:48 PM org.apache.catalina.startup.Catalina start Informações: Server startup in 11083 ms Jul 21, 2014 10:59:26 PM com.sun.faces.lifecycle.ProcessValidationsPhase execute Advertência: /livro.xhtml @13,57 value="#{livroBean.titulo}": Target Unreachable, identifier 'livroBean' resolved to null javax.el.PropertyNotFoundException: /livro.xhtml @13,57 value="#{livroBean.titulo}": Target Unreachable, identifier 'livroBean' resolved to null at com.sun.faces.facelets.el.TagValueExpression.getType(TagValueExpression.java:100) at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getConvertedValue(HtmlBasicInputRenderer.java:95) at javax.faces.component.UIInput.getConvertedValue(UIInput.java:1045) at javax.faces.component.UIInput.validate(UIInput.java:975) at javax.faces.component.UIInput.executeValidate(UIInput.java:1248) at javax.faces.component.UIInput.processValidators(UIInput.java:712) at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1258) at javax.faces.component.UIForm.processValidators(UIForm.java:253) at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1258) at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1258) at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:1195) at com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:76) at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Unknown Source) Caused by: javax.el.PropertyNotFoundException: Target Unreachable, identifier 'livroBean' resolved to null at org.apache.el.parser.AstValue.getTarget(AstValue.java:97) at org.apache.el.parser.AstValue.getType(AstValue.java:81) at org.apache.el.ValueExpressionImpl.getType(ValueExpressionImpl.java:171) at com.sun.faces.facelets.el.TagValueExpression.getType(TagValueExpression.java:98) ... 34 more

Jul 21, 2014 10:59:26 PM org.apache.catalina.core.StandardWrapperValve invoke Grave: Servlet.service() for servlet [Faces Servlet] in context with path [/livraria-jsf] threw exception [/livro.xhtml @13,57 value="#{livroBean.titulo}": Target Unreachable, identifier 'livroBean' resolved to null] with root cause javax.el.PropertyNotFoundException: Target Unreachable, identifier 'livroBean' resolved to null at org.apache.el.parser.AstValue.getTarget(AstValue.java:97) at org.apache.el.parser.AstValue.getType(AstValue.java:81) at org.apache.el.ValueExpressionImpl.getType(ValueExpressionImpl.java:171) at com.sun.faces.facelets.el.TagValueExpression.getType(TagValueExpression.java:98) at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getConvertedValue(HtmlBasicInputRenderer.java:95) at javax.faces.component.UIInput.getConvertedValue(UIInput.java:1045) at javax.faces.component.UIInput.validate(UIInput.java:975) at javax.faces.component.UIInput.executeValidate(UIInput.java:1248) at javax.faces.component.UIInput.processValidators(UIInput.java:712) at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1258) at javax.faces.component.UIForm.processValidators(UIForm.java:253) at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1258) at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1258) at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:1195) at com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:76) at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Unknown Source)

O erro principal é esse:

Target Unreachable, identifier 'livroBean' resolved to null

Verifique se a classe LivroBean está anotada com @ManagedBean. Veja também se importou a annotation do pacote certo, o correto é javax.faces.bean.

Mario esta.

Não sei que pode ser então, precisaria importar o projeto aqui e testar. Consegue me enviar o projeto por email?

mandei mario

solução!

Olá Gustavo.

O projeto subiu normalmente aqui, quando cliquei no botão de gravar deu erro.

o erro foi o seguinte:


Caused by: javax.el.MethodNotFoundException: /livro.xhtml @20,72 action="#{livroBean.livro.gravar}": Method not found: br.com.caelum.livraria.bean.Livro@709f4d93.gravar()
    at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:109)
    at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:87)

Na linha 20 do seu livro.xhtml existe a seguinte linha:

<h:commandButton value ="Gravar" action="#{livroBean.livro.gravar}"/>

Nesta linha você está dizendo que existe um método gravar em Livro. Na verdade, o método é na classe LivroBean. O código correto é:

<h:commandButton value ="Gravar" action="#{livroBean.gravar}"/>

Acho que é isso.

Abraços

tava assim antes no video ai mais a frente no video ele insere...

Você conseguiu resolver aqui, Gustavo?

consegui... mauricio. mas foi o mario que me ajudou e depois eu consegui sosinho. ou colegas q nao estao no alura. obrigaod mario... o q eu te mandei ja ta mais na frente da video aula. erro era do capitulo anterior q era sobre o mysql la e o inicio ja tou mais um pouco mais na frente do video