title: JSF 2 Navigation Rule redirect to home page if user is logged
body: <p>I'm trying to accomplish redirection to home page when user go to login page and is already logged. This how I defined the rule:</p>
  
  <pre><code>&lt;navigation-rule&gt;
      &lt;from-view-id&gt;/login.xhtml&lt;/from-view-id&gt;
      &lt;navigation-case&gt;
          &lt;if&gt;#{identity.loggedIn}&lt;/if&gt;
          &lt;to-view-id&gt;/home.xhtml&lt;/to-view-id&gt;
          &lt;redirect /&gt;
      &lt;/navigation-case&gt;
   &lt;/navigation-rule&gt;
  </code></pre>
  
  <p>But I get the next exception:</p>
  
  <pre><code>WARNING [javax.enterprise.resource.webcontainer.jsf.lifecycle] (default task-26) Error de argumento: el parámetro id es nulo: java.lang.NullPointerException: Error de argumento: el parámetro id es nulo
  at com.sun.faces.util.Util.notNull(Util.java:425) [jsf-impl-2.2.0-jbossorg-2.jar:]
  at com.sun.faces.flow.FlowHandlerImpl.getFlow(FlowHandlerImpl.java:89) [jsf-impl-2.2.0-jbossorg-2.jar:]
  at com.sun.faces.application.NavigationHandlerImpl.determineViewFromActionOutcome(NavigationHandlerImpl.java:1204) [jsf-impl-2.2.0-jbossorg-2.jar:]
  at com.sun.faces.application.NavigationHandlerImpl.findExactMatch(NavigationHandlerImpl.java:568) [jsf-impl-2.2.0-jbossorg-2.jar:]
  at com.sun.faces.application.NavigationHandlerImpl.getViewId(NavigationHandlerImpl.java:462) [jsf-impl-2.2.0-jbossorg-2.jar:]
  at com.sun.faces.application.NavigationHandlerImpl.handleNavigation(NavigationHandlerImpl.java:189) [jsf-impl-2.2.0-jbossorg-2.jar:]
  at com.sun.faces.application.NavigationHandlerImpl.handleNavigation(NavigationHandlerImpl.java:182) [jsf-impl-2.2.0-jbossorg-2.jar:]
  at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:132) [jsf-impl-2.2.0-jbossorg-2.jar:]
  at javax.faces.component.UICommand.broadcast(UICommand.java:315) [jboss-jsf-api_2.2_spec-2.2.0.jar:2.2.0]
  at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:790) [jboss-jsf-api_2.2_spec-2.2.0.jar:2.2.0]
  at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1282) [jboss-jsf-api_2.2_spec-2.2.0.jar:2.2.0]
  at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81) [jsf-impl-2.2.0-jbossorg-2.jar:]
  at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) [jsf-impl-2.2.0-jbossorg-2.jar:]
  at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198) [jsf-impl-2.2.0-jbossorg-2.jar:]
  at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646) [jboss-jsf-api_2.2_spec-2.2.0.jar:2.2.0]
  at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:87) [undertow-servlet-1.0.0.Beta3.jar:1.0.0.Beta3]
  at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:130) [undertow-servlet-1.0.0.Beta3.jar:1.0.0.Beta3]
  at io.undertow.websockets.jsr.JsrWebSocketFilter.doFilter(JsrWebSocketFilter.java:138) [undertow-websockets-jsr-1.0.0.Beta3.jar:1.0.0.Beta3]
  at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:56) [undertow-servlet-1.0.0.Beta3.jar:1.0.0.Beta3]
  at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132) [undertow-servlet-1.0.0.Beta3.jar:1.0.0.Beta3]
  at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:85) [undertow-servlet-1.0.0.Beta3.jar:1.0.0.Beta3]
  at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:82) [undertow-servlet-1.0.0.Beta3.jar:1.0.0.Beta3]
  at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) [undertow-servlet-1.0.0.Beta3.jar:1.0.0.Beta3]
  at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
  at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:115) [undertow-servlet-1.0.0.Beta3.jar:1.0.0.Beta3]
  at io.undertow.security.handlers.AuthenticationCallHandler.handleRequest(AuthenticationCallHandler.java:52) [undertow-core-1.0.0.Beta3.jar:1.0.0.Beta3]
  at io.undertow.security.handlers.AuthenticationConstraintHandler.handleRequest(AuthenticationConstraintHandler.java:51) [undertow-core-1.0.0.Beta3.jar:1.0.0.Beta3]
  at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45) [undertow-core-1.0.0.Beta3.jar:1.0.0.Beta3]
  at io.undertow.servlet.handlers.security.ServletSecurityConstraintHandler.handleRequest(ServletSecurityConstraintHandler.java:55) [undertow-servlet-1.0.0.Beta3.jar:1.0.0.Beta3]
  at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:65) [undertow-servlet-1.0.0.Beta3.jar:1.0.0.Beta3]
  at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:70) [undertow-core-1.0.0.Beta3.jar:1.0.0.Beta3]
  at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.0.Beta3.jar:1.0.0.Beta3]
  at org.wildfly.extension.undertow.security.SecurityContextCreationHandler.handleRequest(SecurityContextCreationHandler.java:54)
  at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.0.Beta3.jar:1.0.0.Beta3]
  at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:185) [undertow-servlet-1.0.0.Beta3.jar:1.0.0.Beta3]
  at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:172) [undertow-servlet-1.0.0.Beta3.jar:1.0.0.Beta3]
  at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:56) [undertow-servlet-1.0.0.Beta3.jar:1.0.0.Beta3]
  at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:107) [undertow-servlet-1.0.0.Beta3.jar:1.0.0.Beta3]
  at io.undertow.server.HttpHandlers.executeRootHandler(HttpHandlers.java:36) [undertow-core-1.0.0.Beta3.jar:1.0.0.Beta3]
  at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:629) [undertow-core-1.0.0.Beta3.jar:1.0.0.Beta3]
  at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [rt.jar:1.7.0_25]
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.7.0_25]
  at java.lang.Thread.run(Unknown Source) [rt.jar:1.7.0_25]
  </code></pre>
  
  <p>The redirection is released but the exception is raised. How can be solved?</p>