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

NullPointExcpetion

Estou tentando criar um dialog e esta retornando esse erro, porque sera? irei postar o codigo.

<?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://xmlns.jcp.org/jsf/html"
        xmlns:f="http://xmlns.jcp.org/jsf/core"
        xmlns:p="http://primefaces.org/ui"
        xmlns:ui="http://xmlns.jcp.org/jsf/facelets">

    <ui:composition template="_template.xhtml">
        <ui:define name="cabecalho">
            <p:outputPanel>Cadastro de Funcionarios</p:outputPanel>
        </ui:define>

        <ui:define name="conteudo">
        <h:form id="cadastro">
        <p:growl id="mensagem" showDetail="true"  />
            <p:fieldset legend="Cadastro">
            <p:panelGrid columns="2">
                <p:outputLabel value="Nome: " for="nome"/>
                <p:inputText id="nome" value="#{funcionarioController.funcionario.nome}" />

                <p:outputLabel value="Idade: " for="idade"/>
                <p:inputText id="idade" value="#{funcionarioController.funcionario.idade}"/>
                <p:outputLabel value="Telefone " for="telefone"/>
                <p:inputMask id="telefone" value="#{funcionarioController.funcionario.telefone}" mask="(999) 999-9999"/>
                <p:outputLabel value="CPF: " for="cpf"/>
                <p:inputMask id="cpf" value="#{funcionarioController.funcionario.cpf}" mask="999.999.999-99"/>
                <p:outputLabel value="Salario " for="salario"/>
                <p:inputNumber id="salario" value="#{funcionarioController.funcionario.salario}">  
                    <p:ajax update="salario" />  
                </p:inputNumber> 
                <p:outputLabel value="Data Contratada:" for="data"/> 
                <p:calendar id="data" value="#{funcionarioController.funcionario.data.time}" showOn="button" locale="de" navigator="true" pattern="dd/MM/yyyy" effect="fold" >
                    <f:convertDateTime pattern="dd/MM/yyyy" timeZone="America/Sao_Paulo"/>
                </p:calendar>
                <p:outputLabel value="Observação: " for="observacao"/>
                <p:inputTextarea rows="6" cols="33" id="observacao" value="#{funcionarioController.funcionario.observacao}" />
                <p:outputLabel value="Cidade: " for="cidade"/>
                <p:inputText id="cidade" value="#{funcionarioController.endereco.cidade}"/>
                <p:outputLabel value="Bairro: " for="bairro"/>
                <p:inputText id="bairro" value="#{funcionarioController.endereco.bairro}"/>
                <p:outputLabel value="CEP " for="cep"/>
                <p:inputText id="cep" value="#{funcionarioController.endereco.cep}"/>
                <p:outputLabel value="Numero Casa: " for="numero"/>
                <p:inputText id="numero" value="#{funcionarioController.endereco.numeroCasa}"/>
            </p:panelGrid>
            </p:fieldset>
            <p:commandButton value="Cadastrar" action="#{funcionarioController.cadastrar}" update="cadastro" process="@all"/>
            <p:commandButton value="Limpar" type="reset" update="@form"/>
            <p:commandButton value="Pesquisar" process="@this" action="#{funcionarioController.abrirDialog}" update="@none"/>
        </h:form>
        </ui:define>
    </ui:composition>
</html>
<?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://xmlns.jcp.org/jsf/html"
    xmlns:f="http://xmlns.jcp.org/jsf/core"
    xmlns:p="http://primefaces.org/ui"
    xmlns:ui="http://xmlns.jcp.org/jsf/facelets">

<ui:composition template="_template.xhtml">
    <ui:define name="cabecalho">
        <p:outputPanel>Tabela Funcionarios</p:outputPanel>
    </ui:define>

    <ui:define name="conteudo">
        <h:form id="cadastro">
            <p:growl id="mensagem" showDetail="true" />
            <p:fieldset legend="Cadastro" toggleable="true" toggleSpeed="500">
                <p:dataTable var="funcionario" value="#{funcionarioController.funcionarios}">
                <p:column headerText="Nome">
                        <h:outputText value="#{funcionario.nome}" />
                    </p:column>
                    <p:column headerText="Telefone">
                        <h:outputText value="#{funcionario.telefone}" />
                    </p:column>
                    <p:column headerText="CPF">
                        <h:outputText value="#{funcionario.cpf}" />
                    </p:column>
                    <p:column headerText="Idade">
                        <h:outputText value="#{funcionario.idade}" />
                    </p:column>
                    <p:column headerText="Salario">
                        <h:outputText value="#{funcionario.salario}">
                            <f:convertNumber type="currency" pattern="R$ #0.00" currencySymbol="R$" locale="pt_BR"/>
                        </h:outputText>
                    </p:column>
                    <p:column headerText="Observações">
                        <h:outputText value="#{funcionario.observacao}" />
                    </p:column>
                    <p:column headerText="Data">
                        <h:outputText value="#{funcionario.data.time}">
                            <f:convertDateTime pattern="dd/MM/yyyy" timeZone="America/Sao_Paulo"/>
                        </h:outputText>
                    </p:column>
                    <p:column headerText="Cidade">
                        <h:outputText value="#{funcionario.endereco.cidade}" />
                    </p:column>
                    <p:column headerText="CEP">
                        <h:outputText value="#{funcionario.endereco.cep}" />
                    </p:column>
                    <p:column headerText="Bairro">
                        <h:outputText value="#{funcionario.endereco.bairro}" />
                    </p:column>
                    <p:column headerText="Numero Casa">
                        <h:outputText value="#{funcionario.endereco.numeroCasa}" />
                    </p:column>
                    <p:column headerText="Remover">
                        <p:commandLink value="Excluir" action="#{funcionarioController.remover(funcionario)}" update="@form" process="@form"/>
                    </p:column>
                    <p:column headerText="Alteracao">
                        <p:commandLink value="alterar" actionListener="#{funcionarioController.carregar(funcionario)}" action="#{funcionarioController.formularioFuncionario}" update="@form" process="@form"/>
                    </p:column>
                </p:dataTable>
            </p:fieldset>
        </h:form>
    </ui:define>
</ui:composition>

</html>
    public void abrirDialog() {
        java.util.Map<String, Object> opcoes = new HashMap<String, Object>();

        RequestContext.getCurrentInstance().openDialog("tabelaFucionario", opcoes, null);
    }

O erro e esse

nov 07, 2016 6:07:26 PM com.sun.faces.context.AjaxExceptionHandlerImpl handlePartialResponseError
GRAVE: java.lang.NullPointerException
    at org.primefaces.application.DialogNavigationHandler.handleNavigation(DialogNavigationHandler.java:48)
    at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:132)
    at org.primefaces.application.DialogActionListener.processAction(DialogActionListener.java:45)
    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 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(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)
3 respostas
solução!

Oi Alisson,

Acho que o JSF não está achando a sua página. Tenta passar o caminho completo a partir do WebContent:

RequestContext.getCurrentInstance().openDialog("/CAMINHO_COMPLETO/tabelaFucionario", opcoes, null);

Abraço!

Joviane não o meu não esta no caminho completo? oque que esta faltando?

Joviane consegui arrumar o meu código, muito obrigado.