title: javax.el.PropertyNotFoundException: /demo.xhtml @24,55 value="#{UserBean.favYear3}": Target Unreachable, identifier 'UserBean' resolved to null
body: <p>I want to have a list box in JSF. I have written a simple code but it does not work. In demo page I see an empty box with out list and in user page I have error.</p>
  
  <p>UserBean.java</p>
  
  <pre><code>@ManagedBean
  @SessionScoped   
  public class UserBean implements Serializable{
      public String favYear3;//list box
  
      public String getFavYear3() {
          return favYear3;
      }
  
      public void setFavYear3(String favYear3) {
          this.favYear3 = favYear3;
      }
      public static class Year{
          public String yearLabel;
          public String yearValue;
  
          public Year(String yearLabel, String yearValue){
              this.yearLabel = yearLabel;
              this.yearValue = yearValue;
          }
  
          public String getYearLabel(){
              return yearLabel;
          }
  
          public String getYearValue(){
              return yearValue;
          }
  
      }
  
      public Year[] year3List;
  
      public Year[] getFavYear3Value() {
  
          year3List = new Year[3];
          year3List[0] = new Year("Year3 - 2000", "2000");
          year3List[1] = new Year("Year3 - 2010", "2010");
          year3List[2] = new Year("Year3 - 2020", "2020");
  
          return year3List;
      }
  
  }
  </code></pre>
  
  <p>demo.xhtml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:f="http://java.sun.com/jsf/core"&gt;
  &lt;head&gt;
      &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt;
      &lt;title&gt;first jsf page&lt;/title&gt;
  &lt;/head&gt;
  &lt;h:body&gt;
      &lt;h1&gt;JSF 2 check example&lt;/h1&gt;
  
      &lt;h:form&gt;
          &lt;h:selectOneListbox value="#{UserBean.favYear3}"&gt;
              &lt;f:selectItems value="#{UserBean.favYear3Value}" var="y"
                  itemLabel="#{y.yearLabel}" itemValue="#{y.yearValue}" /&gt;
          &lt;/h:selectOneListbox&gt;
      &lt;/h:form&gt;
  
  &lt;/h:body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>user.xhtml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:h="http://java.sun.com/jsf/html"&gt;
  &lt;head&gt;
      &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
      &lt;title&gt;second jsf page&lt;/title&gt;
  &lt;/head&gt;
  &lt;h:body&gt;
      &lt;h:outputText value="#{UserBean.favYear3}"/&gt;
  &lt;/h:body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>My problem: in demo page I have an empty box.
  in user page the error is:</p>
  
  <pre><code>type Exception report
  
  message 
  
  description The server encountered an internal error () that prevented it from fulfilling this request.
  
  exception 
  
  javax.servlet.ServletException: javax.el.PropertyNotFoundException: /demo.xhtml @24,55 value="#{UserBean.favYear3}": Target Unreachable, identifier 'UserBean' resolved to null
      javax.faces.webapp.FacesServlet.service(FacesServlet.java:321)
  
  
  root cause 
  
  javax.faces.component.UpdateModelException: javax.el.PropertyNotFoundException: /demo.xhtml @24,55 value="#{UserBean.favYear3}": Target Unreachable, identifier 'UserBean' resolved to null
      javax.faces.component.UIInput.updateModel(UIInput.java:848)
      javax.faces.component.UIInput.processUpdates(UIInput.java:730)
      javax.faces.component.UIForm.processUpdates(UIForm.java:268)
      javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:1109)
      javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:1109)
      javax.faces.component.UIViewRoot.processUpdates(UIViewRoot.java:1218)
      com.sun.faces.lifecycle.UpdateModelValuesPhase.execute(UpdateModelValuesPhase.java:74)
      com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
      com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:114)
      javax.faces.webapp.FacesServlet.service(FacesServlet.java:308)
  </code></pre>
  
  <p>What is wrong?</p>