Quando clico em alterar esta mensagem é exibida.
`` HTTP Status 500 - javax.el.MethodNotFoundException: /livro.xhtml @106,75 action="#{livroBean.carregar(livro)}": Method not found: br.com.caelum.livraria.bean.LivroBean@7f856ee0.carregar(br.com.caelum.livraria.modelo.Livro)
type Exception report
message javax.el.MethodNotFoundException: /livro.xhtml @106,75 action="#{livroBean.carregar(livro)}": Method not found: br.com.caelum.livraria.bean.LivroBean@7f856ee0.carregar(br.com.caelum.livraria.modelo.Livro)
description The server encountered an internal error that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: javax.el.MethodNotFoundException: /livro.xhtml @106,75 action="#{livroBean.carregar(livro)}": Method not found: br.com.caelum.livraria.bean.LivroBean@7f856ee0.carregar(br.com.caelum.livraria.modelo.Livro) javax.faces.webapp.FacesServlet.service(FacesServlet.java:606) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
root cause
javax.faces.el.MethodNotFoundException: javax.el.MethodNotFoundException: /livro.xhtml @106,75 action="#{livroBean.carregar(livro)}": Method not found: br.com.caelum.livraria.bean.LivroBean@7f856ee0.carregar(br.com.caelum.livraria.modelo.Livro) javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:91) com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:101) javax.faces.component.UICommand.broadcast(UICommand.java:315) javax.faces.component.UIData.broadcast(UIData.java:1092) javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:791) javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1256) com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81) com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) 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)
root cause
javax.el.MethodNotFoundException: /livro.xhtml @106,75 action="#{livroBean.carregar(livro)}": Method not found: br.com.caelum.livraria.bean.LivroBean@7f856ee0.carregar(br.com.caelum.livraria.modelo.Livro) com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:109) javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:87) com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:101) javax.faces.component.UICommand.broadcast(UICommand.java:315) javax.faces.component.UIData.broadcast(UIData.java:1092) javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:791) javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1256) com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81) com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) 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 Apache Tomcat/8.0.33 logs. ``
Meu Código
<?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"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets">
<ui:composition template="_template.xhtml">
<ui:define name="titulo">
Novo Livro
</ui:define>
<ui:define name="conteudo">
<h:form>
<h:messages id="messages" />
<fieldset>
<legend>Dados do Livro</legend>
<h:panelGrid columns="2">
<h:outputLabel value="Titulo:" for="titulo" />
<h:inputText id="titulo" value="#{livroBean.livro.titulo}"
required="true" requiredMessage="Título obrigatório"
validatorMessage="Título não pode ser superior a 40">
<f:validateLength maximum="40" />
<f:ajax event="blur" render="messages" />
</h:inputText>
<h:outputLabel value="ISBN:" for="isbn" />
<h:inputText id="isbn" value="#{livroBean.livro.isbn}"
validator="#{livroBean.comecaComDigitoUm}" />
<h:outputLabel value="Preço:" for="preco" />
<h:inputText id="preco" value="#{livroBean.livro.preco}" />
<h:outputLabel value="Data de Lançamento:" for="dataLancamento" />
<h:inputText id="dataLancamento"
value="#{livroBean.livro.dataLancamento.time}">
<f:convertDateTime pattern="dd/MM/yyyy"
timeZone="America/Sao_Paulo" />
</h:inputText>
</h:panelGrid>
</fieldset>
<fieldset>
<legend>Dados do Autor</legend>
<h:outputLabel value="Selecione Autor:" for="autor" />
<h:selectOneMenu value="#{livroBean.autorId}" id="autor">
<f:selectItems value="#{livroBean.autores}" var="autor"
itemLabel="#{autor.nome}" itemValue="#{autor.id}" />
</h:selectOneMenu>
<h:commandButton value="Gravar Autor"
action="#{livroBean.gravarAutor}">
<f:ajax execute="autor" render="tabelaAutores" />
</h:commandButton>
<br />
<h:commandLink value="Cadastrar novo autor"
action="#{livroBean.formAutor}" immediate="true" />
<h:dataTable value="#{livroBean.autoresDoLivro}" var="autor"
id="tabelaAutores">
<h:column>
<h:outputText value="#{autor.nome}" />
</h:column>
</h:dataTable>
</fieldset>
<h:commandButton value="Gravar" action="#{livroBean.gravar}">
<f:ajax execute="@form" render="@form :formTabelaLivros:tabelaLivros" />
</h:commandButton>
</h:form>
<h:form id="formTabelaLivros">
<h:dataTable value="#{livroBean.livros}" var="livro" id="tabelaLivros">
<h:column>
<f:facet name="header">Título</f:facet>
<h:outputText value="#{livro.titulo}" />
</h:column>
<h:column>
<f:facet name="header">ISBN</f:facet>
<h:outputText value="#{livro.isbn}" />
</h:column>
<h:column>
<f:facet name="header">Preço</f:facet>
<h:outputText value="#{livro.preco}">
<f:convertNumber type="currency" pattern="R$ #0.00"
currencySymbol="R$" locale="pt_BR" />
</h:outputText>
</h:column>
<h:column>
<f:facet name="header">Data</f:facet>
<h:outputText value="#{livro.dataLancamento.time}">
<f:convertDateTime pattern="dd/MM/yyyy"
timeZone="America/Sao_Paulo" />
</h:outputText>
</h:column>
<h:column>
<f:facet name="header">Alterar</f:facet>
<h:commandLink value="altera" action="#{livroBean.carregar(livro)}"/>
</h:column>
<h:column>
<f:facet name="header">Remover</f:facet>
<h:commandLink value="remove" action="#{livroBean.remover(livro)}"/>
</h:column>
</h:dataTable>
</h:form>
</ui:define>
</ui:composition>
</html>