jsf 2 - NullPointerException while resolving navigation case on a ViewExpiredException -


i've created custom exception handler should navigate specific view on viewexpiredexception.

exceptionqueuedeventcontext context = (exceptionqueuedeventcontext) event.getsource(); throwable t = context.getexception();  if (t instanceof viewexpiredexception) {     viewexpiredexception v = (viewexpiredexception) t;     facescontext fc = facescontext.getcurrentinstance();     map<string, object> requestmap = fc.getexternalcontext().getrequestmap();     navigationhandler nav = fc.getapplication().getnavigationhandler();      try {         requestmap.put("currentviewid", v.getviewid());         nav.handlenavigation(fc, "*", "viewexpired"+"?faces-redirect=true");         fc.renderresponse(); 

however, throws following exception on line nav.handlenavigation()

 java.lang.nullpointerexception     @ org.apache.myfaces.application.navigationhandlerimpl.getnavigationcase(navigationhandlerimpl.java:203)     @ org.apache.myfaces.application.navigationhandlerimpl.handlenavigation(navigationhandlerimpl.java:77)     @ com.daimler.esr.ui.exception.defaultexceptionhandler.handle(defaultexceptionhandler.java:55)     @ org.apache.myfaces.lifecycle.lifecycleimpl.executephase(lifecycleimpl.java:191)     @ org.apache.myfaces.lifecycle.lifecycleimpl.execute(lifecycleimpl.java:118)     @ javax.faces.webapp.facesservlet.service(facesservlet.java:189)     @ com.ibm.ws.webcontainer.servlet.servletwrapper.service(servletwrapper.java:1188)     @ com.ibm.ws.webcontainer.servlet.servletwrapper.handlerequest(servletwrapper.java:763)     @ com.ibm.ws.webcontainer.servlet.servletwrapper.handlerequest(servletwrapper.java:454)     @ com.ibm.ws.webcontainer.servlet.servletwrapperimpl.handlerequest(servletwrapperimpl.java:178)     @ com.ibm.ws.webcontainer.filter.webappfilterchain.invoketarget(webappfilterchain.java:125)     @ com.ibm.ws.webcontainer.filter.webappfilterchain.dofilter(webappfilterchain.java:92)     @ org.primefaces.webapp.filter.fileuploadfilter.dofilter(fileuploadfilter.java:79)     @ com.ibm.ws.webcontainer.filter.filterinstancewrapper.dofilter(filterinstancewrapper.java:192)     @ com.ibm.ws.webcontainer.filter.webappfilterchain.dofilter(webappfilterchain.java:89)     @ com.ibm.ws.webcontainer.filter.webappfiltermanager.dofilter(webappfiltermanager.java:919)     @ com.ibm.ws.webcontainer.filter.webappfiltermanager.invokefilters(webappfiltermanager.java:1016)     @ com.ibm.ws.webcontainer.webapp.webapp.handlerequest(webapp.java:3703)     @ com.ibm.ws.webcontainer.webapp.webgroup.handlerequest(webgroup.java:304)     @ com.ibm.ws.webcontainer.webcontainer.handlerequest(webcontainer.java:962)     @ com.ibm.ws.webcontainer.wswebcontainer.handlerequest(wswebcontainer.java:1662)     @ com.ibm.ws.webcontainer.channel.wcchannellink.ready(wcchannellink.java:195)     @ com.ibm.ws.http.channel.inbound.impl.httpinboundlink.handlediscrimination(httpinboundlink.java:452)     @ com.ibm.ws.http.channel.inbound.impl.httpinboundlink.handlenewrequest(httpinboundlink.java:511)     @ com.ibm.ws.http.channel.inbound.impl.httpinboundlink.processrequest(httpinboundlink.java:305)     @ com.ibm.ws.http.channel.inbound.impl.httpinboundlink.ready(httpinboundlink.java:276) 

i'm using myfaces , primfaces 3.4.

don't specify "from" of "*", instead make null.

nav.handlenavigation(fc, null, "viewexpired?faces-redirect=true"); 

when specify non-null "from", current view id needs determined in order find associated "from" though it's wildcard "*". current view expired (you got viewexpiredexception, right?), it's not available anymore , hence nullpointerexception in internal code on line context.getviewroot().getviewid().


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -