0 Replies Latest reply on May 24, 2012 1:36 AM by rmutha

    Target Unreachable, identifier '{Identity <CDI Bean name>}' resolved to null

    rmutha

      Hi i am struggling from last one day to solve this issue on jboss 7.1 as final.

       

       

      Exception PropertyNotFoundException: javax.el.PropertyNotFoundException: /home.xhtml @18,85 listener="#{identity.isLoggedIn}": Target Unreachable, identifier 'identity' resolved to null.

       

      Here i have added beans.xml in web-inf directory of web application.

       

      Structure: (Ear(War(Web-Inf(beans.xml ))))

       

       

      Home.xhtml

      -----------------------------------------------------

      <f:metadata>

                           <!-- <f:viewAction execute="#{recordListManager.listAllUserDataByCriteria('SEARCH_CRITERIA', true)}" onPostback="true"/>

                           <f:viewAction execute="#{recordListManager.listAllUserDataByCriteria('RECORD_LIST', true)}" onPostback="true"/>

                           -->

                           <f:event listener="#{identity.isLoggedIn}" type="preRenderView" />

                           <f:event type="preRenderView" listener="#{recordListManager.listAllUserDataByCriteria('SEARCH_CRITERIA', true)}"  />

                           <f:event type="preRenderView" listener="#{recordListManager.listAllUserDataByCriteria('SEARCH_CRITERIA', true)}" />

      </f:metadata>

       

      Identity.java

      ------------------------------------------------------

      import java.io.Serializable;

      import java.util.HashMap;

      import java.util.Map;

       

      import javax.enterprise.context.SessionScoped;

      import javax.faces.application.ConfigurableNavigationHandler;

      import javax.faces.context.FacesContext;

      import javax.faces.event.ComponentSystemEvent;

      import javax.inject.Named;

       

      import org.slf4j.Logger;

      import org.slf4j.LoggerFactory;

       

       

      @SuppressWarnings("serial")

      @Named ("identity")

      @SessionScoped

      public class Identity implements Serializable {

       

          /**

           *

           */

       

          Map<String, String> roleMap = new HashMap<String, String>();

          boolean loggedIn =false;

       

         

      public void isLoggedIn(ComponentSystemEvent event){

              log.info("~~~~~~~~~com.l1id.abis.im.web.application.login.Identity.isLoggedIn(ComponentSystemEvent)~~~~~~~~");

                  FacesContext fc = FacesContext.getCurrentInstance();

                  if(!isLoggedIn()){

                      ConfigurableNavigationHandler nav

                         = (ConfigurableNavigationHandler)

                          fc.getApplication().getNavigationHandler();

                      log.info("~~~~~~~~~User Not Logged in!~~~~~~~~");

                      nav.performNavigation("login");

                  }

          }  

       

      }