title: Pick Custom Object from Select one menu JSF Converter Exception
body: <p>i want to pick custom object from select one menu. it neither shows an error nor values. what to do? please help me. thanks in advance. </p>
  
  <p>Now i'm seeing Null pointer exception at getAsObject at this line:</p>
  
  <pre><code>return getCurrencyService().getCurrencyBtId(currencyId);
  </code></pre>
  
  <p><strong>this is my xhtml document</strong></p>
  
  <pre><code>&lt;h:panelGrid columns="2"&gt;
      &lt;p:outputLabel value="" /&gt;
          &lt;p:selectOneMenu id="CurrencyMenu" value="#{CurrencyMB.currency}" converter="currencyConverter" &gt;
          &lt;f:selectItems value="#{CurrencyMB.currencyList}" var="currency"  itemValue="#{currency}" itemLabel="#{currency.currencyName}" &gt;    
              &lt;/f:selectItems&gt;
          &lt;p:ajax update="currencyOut" /&gt;
          &lt;/p:selectOneMenu&gt;
          &lt;p:outputLabel value="Currency Id : #{CurrencyMB.currency.currencyId}" id="currencyOut" /&gt;
  &lt;/h:panelGrid&gt;
  </code></pre>
  
  <p><strong>this is my managedBean class.</strong></p>
  
  <pre><code>@ManagedBean(name = "CurrencyMB")
  @RequestScoped
  public class CurrencyManagedBean implements Serializable{
  
  private Currency currency;
  private List&lt;Currency&gt; currencyList;
  
  
  public Currency getCurrency() {
          return currency;
      }
  
  public void setCurrency(Currency currency) {
          this.currency = currency;
      }
  public List&lt;Currency&gt; getCurrencyList() {
          currencyList = new ArrayList&lt;Currency&gt;();
          currencyList.addAll(getiCurrencyService().getCurrencies());
          return currencyList;
      }
  
  public void setCurrencyList(List&lt;Currency&gt; currencyList) {
          this.currencyList = currencyList;
      }
  
  }
  </code></pre>
  
  <p><strong>this is my currencyConverter class code:</strong></p>
  
  <pre><code>**@FacesConverter("currencyConverter")
  public class CurrencyConverter implements Converter {
      @ManagedProperty(value = "#{currencyService}")
      private ICurrencyService currencyService;
  
  
      public ICurrencyService getCurrencyService() {
          return currencyService;
      }
      public void setCurrencyService(ICurrencyService currencyService) {
          this.currencyService = currencyService;
      }
      @Override
      public Object getAsObject(FacesContext arg0, UIComponent arg1, String value) {
  
          int currencyId = Integer.valueOf(value);
          return getCurrencyService().getCurrencyBtId(currencyId);
      }
      @Override
      public String getAsString(FacesContext arg0, UIComponent arg1, Object value) {
          Currency currency = (Currency) value;
          int currencyId = currency.getCurrencyId();
          return String.valueOf(currencyId);
      }
  }**
  </code></pre>