3
Uu method, to be called gives NullPointException
.
Has an expression that validates when editing appears header "Product Editing", if New registration appears "new". No cadastroProdutoBean.java
has method boolean isEditando
, on it is giving error.
Method:
public boolean isEditando() {
return this.produto.getId() != null;
}
Expression in xhtml:
#{cadastroProdutoBean.editando ? 'Edição de Produto' : 'Novo Produto'}
Follow the log:
GRAVE: Error Rendering View[/produtos/CadastroProduto.xhtml]
javax.el.ELException: /produtos/CadastroProduto.xhtml: Error reading 'editando' on type com.oliveira.pedidovenda.controller.CadastroProdutoBean
at com.sun.faces.facelets.compiler.TextInstruction.write(TextInstruction.java:88)
at com.sun.faces.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:82)
at com.sun.faces.facelets.compiler.UILeaf.encodeAll(UILeaf.java:183)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:458)
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:134)
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:337)
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:337)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:219)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:651)
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:218)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:442)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1082)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:623)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException
at com.oliveira.pedidovenda.controller.CadastroProdutoBean.isEditando(CadastroProdutoBean.java:106)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at javax.el.BeanELResolver.getValue(BeanELResolver.java:99)
at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)
at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)
at org.apache.el.parser.AstValue.getValue(AstValue.java:184)
at org.apache.el.parser.AstChoice.getValue(AstChoice.java:44)
at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:184)
at org.jboss.weld.el.WeldValueExpression.getValue(WeldValueExpression.java:50)
at com.sun.faces.facelets.el.ELText$ELTextVariable.writeText(ELText.java:238)
at com.sun.faces.facelets.compiler.TextInstruction.write(TextInstruction.java:85)
... 32 more
01:32:40.663 [http-bio-8080-exec-6] ERROR com.oliveira.pedidovenda.util.jsf.JsfExceptionHandler - Erro de sistema: /produtos/CadastroProduto.xhtml: Error reading 'editando' on type com.oliveira.pedidovenda.controller.CadastroProdutoBean
javax.el.ELException: /produtos/CadastroProduto.xhtml: Error reading 'editando' on type com.oliveira.pedidovenda.controller.CadastroProdutoBean
at com.sun.faces.facelets.compiler.TextInstruction.write(TextInstruction.java:88) ~[javax.faces-2.2.8-15.jar:2.2.8-15]
at com.sun.faces.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:82) ~[javax.faces-2.2.8-15.jar:2.2.8-15]
at com.sun.faces.facelets.compiler.UILeaf.encodeAll(UILeaf.java:183) ~[javax.faces-2.2.8-15.jar:2.2.8-15]
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859) ~[javax.faces-2.2.8-15.jar:2.2.8-15]
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859) ~[javax.faces-2.2.8-15.jar:2.2.8-15]
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:458) ~[javax.faces-2.2.8-15.jar:2.2.8-15]
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:134) ~[javax.faces-2.2.8-15.jar:2.2.8-15]
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:337) ~[javax.faces-2.2.8-15.jar:2.2.8-15]
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:337) ~[javax.faces-2.2.8-15.jar:2.2.8-15]
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120) ~[javax.faces-2.2.8-15.jar:2.2.8-15]
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) [javax.faces-2.2.8-15.jar:2.2.8-15]
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:219) [javax.faces-2.2.8-15.jar:2.2.8-15]
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:651) [javax.faces-2.2.8-15.jar:2.2.8-15]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) [catalina.jar:7.0.70]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) [catalina.jar:7.0.70]
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) [tomcat7-websocket.jar:7.0.70]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) [catalina.jar:7.0.70]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) [catalina.jar:7.0.70]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:218) [catalina.jar:7.0.70]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) [catalina.jar:7.0.70]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505) [catalina.jar:7.0.70]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169) [catalina.jar:7.0.70]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) [catalina.jar:7.0.70]
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956) [catalina.jar:7.0.70]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) [catalina.jar:7.0.70]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:442) [catalina.jar:7.0.70]
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1082) [tomcat-coyote.jar:7.0.70]
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:623) [tomcat-coyote.jar:7.0.70]
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318) [tomcat-coyote.jar:7.0.70]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_92]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_92]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-coyote.jar:7.0.70]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_92]
Caused by: java.lang.NullPointerException
at com.oliveira.pedidovenda.controller.CadastroProdutoBean.isEditando(CadastroProdutoBean.java:106) ~[classes/:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_92]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_92]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_92]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_92]
at javax.el.BeanELResolver.getValue(BeanELResolver.java:99) ~[el-api.jar:2.2.FR]
at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176) ~[javax.faces-2.2.8-15.jar:2.2.8-15]
at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203) ~[javax.faces-2.2.8-15.jar:2.2.8-15]
at org.apache.el.parser.AstValue.getValue(AstValue.java:184) ~[jasper-el.jar:7.0.70]
at org.apache.el.parser.AstChoice.getValue(AstChoice.java:44) ~[jasper-el.jar:7.0.70]
at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:184) ~[jasper-el.jar:7.0.70]
at org.jboss.weld.el.WeldValueExpression.getValue(WeldValueExpression.java:50) ~[weld-servlet-2.3.2.Final.jar:2.3.2.Final]
at com.sun.faces.facelets.el.ELText$ELTextVariable.writeText(ELText.java:238) ~[javax.faces-2.2.8-15.jar:2.2.8-15]
at com.sun.faces.facelets.compiler.TextInstruction.write(TextInstruction.java:85) ~[javax.faces-2.2.8-15.jar:2.2.8-15]
... 32 more
Hello, Adriano. Welcome to [en.so]! Next time, try to format your question better by correctly putting the code and the log as I did above, otherwise it is very difficult to understand what is happening. Also, try not to use comments to add code or information. You should edit your question and add there.
– utluiz