Method not found

28/04/2017

0

Pessoal, estou com uma dificuldade em um projeto. O projeto usa o padrão Maven; e EJB (Wildfly), JSF, JPA (Hibernate), PrimeFaces e OmniFaces (Conversor). Existe uma página funcionario.xhtml que é para cadastrar funcionário relacionando ele a uma empresa (@ManyToOny). A página aparece normalmente, mas na hora de salvar o funcionário gera um erro alegando que o método salvar não foi localizado. No entanto já fiz diversos testes e pesquisei na net e vi bastante assunto com esse mesmo erro, mas nada resolveu a minha questão.

Antes de colar trechos do meu código, deixo aqui o link do Projeto (GitHub) para ver ele completo.

Log do erro:

00:16:10,506 WARNING [javax.enterprise.resource.webcontainer.jsf.lifecycle] (default task-10) #{funcionarioBean.salvar}: javax.el.MethodNotFoundException: /funcionario.xhtml @63,73 action="#{funcionarioBean.salvar}": Method not found: class br.com.sindiatacadista.bean.FuncionarioBean$Proxy$_$$_WeldSubclass.salvar(): javax.faces.FacesException: #{funcionarioBean.salvar}: javax.el.MethodNotFoundException: /funcionario.xhtml @63,73 action="#{funcionarioBean.salvar}": Method not found: class br.com.sindiatacadista.bean.FuncionarioBean$Proxy$_$$_WeldSubclass.salvar()
    at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:110)
    at javax.faces.component.UICommand.broadcast(UICommand.java:315)
    at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:790)
    at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1282)
    at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
    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:658)
    at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
    at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
    at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
    at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
    at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
    at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
    at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
    at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
    at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
    at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
    at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
    at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
    at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
    at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:292)
    at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81)
    at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138)
    at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135)
    at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
    at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
    at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
    at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
    at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
    at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
    at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
    at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
    at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272)
    at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
    at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:104)
    at io.undertow.server.Connectors.executeRootHandler(Connectors.java:202)
    at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:805)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: javax.faces.el.MethodNotFoundException: javax.el.MethodNotFoundException: /funcionario.xhtml @63,73 action="#{funcionarioBean.salvar}": Method not found: class br.com.sindiatacadista.bean.FuncionarioBean$Proxy$_$$_WeldSubclass.salvar()
    at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:91)
    at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
    ... 45 more
Caused by: javax.el.MethodNotFoundException: /funcionario.xhtml @63,73 action="#{funcionarioBean.salvar}": Method not found: class br.com.sindiatacadista.bean.FuncionarioBean$Proxy$_$$_WeldSubclass.salvar()
    at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:109)
    at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:87)
    ... 46 more
00:16:10,514 SEVERE [javax.enterprise.resource.webcontainer.jsf.context] (default task-10) javax.faces.el.MethodNotFoundException: javax.el.MethodNotFoundException: /funcionario.xhtml @63,73 action="#{funcionarioBean.salvar}": Method not found: class br.com.sindiatacadista.bean.FuncionarioBean$Proxy$_$$_WeldSubclass.salvar()
    at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:91)
    at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
    at javax.faces.component.UICommand.broadcast(UICommand.java:315)
    at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:790)
    at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1282)
    
Hugo Nóbrega

Hugo Nóbrega

Responder

Posts

28/04/2017

Angelo Santos

Olá Hugo Nóbrega,

Conforme verifiquei no seu código seu FuncionarioBean não possui um método "salvar()" e sim um método salvar(Funcionario funcionario).
Coloque o seguinte código na sua classe FuncionarioBean e verifique se funciona:

public void salvar() {
		System.out.println("Entrou no salvar da classe funcionarioBean");		
}


Você vai precisar reformular sua classe FuncionarioBean.

Espero ter ajudado!
Responder

28/04/2017

Hugo Nóbrega

Ajudou e muito!
Value, Angelo! Valeu mesmo!
Resolveu meu problema.... não estava vendo esse detalhe. Por mais básico que seja, eu tinha travado...
Obrigado por dedicar o seu tempo e compartilhar o seu conhecimento!
Grato pela força!!!!
Responder

Assista grátis a nossa aula inaugural

Assitir aula

Saiba por que programar é uma questão de
sobrevivência e como aprender sem riscos

Assistir agora

Utilizamos cookies para fornecer uma melhor experiência para nossos usuários, consulte nossa política de privacidade.

Aceitar