Boa Tarde De novo
Estou com outro problema, tenho um h:SelectOneMenu, com 3 opções, a opção 1 ele retornar o codigo 1, a opçao 2 o codigo 2 e a opçao 3 o codigo 3, quando ele vai pro MB ele está passando o valor para varável, mas se eu escolho a opção 2 ou 3, ele da um nullpointer.
parte do selectOneMenu e parte do MB
<h:outputLabel id="outTipoDeTermo"
value="Selecione o Tipo de Termo">
</h:outputLabel>
<h:selectOneMenu id="selTipoDeTermo"
value="#{MenuFiscalizacaoRegistroView.codTipoTermo}"
required="true" immediate="true"
requiredMessage="Campo Tipo de Termo obrigatório">
<f:selectItem itemValue="" itemLabel="Selecione..." />
<f:selectItems value="#{MenuFiscalizacaoRegistroView.retornarTipoTermo}"/>
<a4j:support ajaxSingle="true"
event="onchange"
action="#{MenuFiscalizacaoRegistroView.carregarListas}"
reRender="selListShuttleBemApreendido, selListShuttleNatureza, panelGroupVisualizarTermos" >
</a4j:support>
</h:selectOneMenu>
<br>
<rich:listShuttle id="selListShuttleBemApreendido"
sourceValue="#{MenuFiscalizacaoRegistroView.arrayListBemApreendidos}"
targetValue="#{MenuFiscalizacaoRegistroView.arrayListBemApreendidosSalvar}"
var="tipoBemApreendido" converter="converteTipoBemApreendido"
sourceCaptionLabel="Tipos de Bens Apreendidos"
targetCaptionLabel="Tipos de Bens Apreendidos para Salvar"
copyControlLabel="Copiar"
removeControlLabel="Remover"
copyAllControlLabel="Copiar Tudo"
removeAllControlLabel="Remover Tudo"
fastOrderControlsVisible="false"
orderControlsVisible="false"
rendered="#{MenuFiscalizacaoRegistroView.codTipoTermo==1}"
requiredMessage="Campo Bens Apreendidos obrigatório" >
<rich:column width="100%">
<h:outputText value="#{tipoBemApreendido.tipoBemApreendidoDescricao} "/>
</rich:column>
</rich:listShuttle>
<br>
<rich:listShuttle id="selListShuttleNatureza"
sourceValue="#{MenuFiscalizacaoRegistroView.arrayListTipoNatureza}"
targetValue="#{MenuFiscalizacaoRegistroView.arrayListTipoNaturezaSalvar}"
var="tipoNatureza" converter="converteTipoNatureza"
sourceCaptionLabel="Tipos Natureza"
targetCaptionLabel="Tipos Natureza para Salvar"
copyControlLabel="Copiar"
removeControlLabel="Remover"
copyAllControlLabel="Copiar Tudo"
removeAllControlLabel="Remover Tudo"
fastOrderControlsVisible="false"
orderControlsVisible="false"
rendered="#{MenuFiscalizacaoRegistroView.codTipoTermo==2}"
requiredMessage="Campo Tipo Natureza obrigatório">
<rich:column width="100%">
<h:outputText value="#{tipoNatureza.tipoNaturezaDescricao} "/>
</rich:column>
</rich:listShuttle>
ManagedBean
public void carregarListas() {
if(codTipoTermo==1 || (termo.getTipoTermo() != null && termo.getTipoTermo().getTipoTermoCodigo()==1)){
arrayListBemApreendidos = (ArrayList<TipoBemApreendido>) new TipoBemApreendidoDao().listaTudo();
}else{
if(codTipoTermo==2 || (termo.getTipoTermo() != null && termo.getTipoTermo().getTipoTermoCodigo()==2)) {
arrayListTipoNatureza = (ArrayList<TipoNatureza>) new TipoNaturezaDao().listaTudo();
}
}
}
Eu entro no modo DEBUG, ele mostra q a variavel ta com o CODTIPOTERMO==2 ele nao entra no primeiro IF, ou seja, ele faz a comparaçao, mas logo depois da comparacao ele da um NULLPOINTER.
o erro é o seguinte:
6:09:33,883 SEVERE [application] java.lang.NullPointerException
javax.faces.el.EvaluationException: java.lang.NullPointerException
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:102)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
at javax.faces.component.UICommand.broadcast(UICommand.java:387)
at org.ajax4jsf.component.AjaxActionComponent.broadcast(AjaxActionComponent.java:55)
at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:329)
at org.ajax4jsf.component.AjaxViewRoot.broadcastEventsForPhase(AjaxViewRoot.java:304)
at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:261)
at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:474)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206)
at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at brd.sinfam.filters.HibernateFilter.doFilter(HibernateFilter.java:35)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at brd.sinfam.util.UserLogado.doFilter(UserLogado.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at brd.sinfam.view.MenuFiscalizacaoRegistroView.carregarListas(MenuFiscalizacaoRegistroView.java:1395)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.el.parser.AstValue.invoke(AstValue.java:170)
at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
at org.apache.jasper.el.JspMethodExpression.invoke(JspMethodExpression.java:68)
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
... 43 more
16:09:33,883 WARNING [lifecycle] #{MenuFiscalizacaoRegistroView.carregarListas}: java.lang.NullPointerException
javax.faces.FacesException: #{MenuFiscalizacaoRegistroView.carregarListas}: java.lang.NullPointerException
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:118)
at javax.faces.component.UICommand.broadcast(UICommand.java:387)
at org.ajax4jsf.component.AjaxActionComponent.broadcast(AjaxActionComponent.java:55)
at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:329)
at org.ajax4jsf.component.AjaxViewRoot.broadcastEventsForPhase(AjaxViewRoot.java:304)
at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:261)
at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:474)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206)
at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at brd.sinfam.filters.HibernateFilter.doFilter(HibernateFilter.java:35)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at brd.sinfam.util.UserLogado.doFilter(UserLogado.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Unknown Source)
Caused by: javax.faces.el.EvaluationException: java.lang.NullPointerException
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:102)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
... 42 more
Caused by: java.lang.NullPointerException
at brd.sinfam.view.MenuFiscalizacaoRegistroView.carregarListas(MenuFiscalizacaoRegistroView.java:1395)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.el.parser.AstValue.invoke(AstValue.java:170)
at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
at org.apache.jasper.el.JspMethodExpression.invoke(JspMethodExpression.java:68)
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
... 43 more