title: Identity 'chartBean' does not reference a MethodExpression instance
body: <p>This chart is displayed very nice but the log is not nice at all.</p>
  
  <p>I cannot find the reason for the exception.
  Any suggestions are appreciated!!
  I believe in two scenarios, there is no instance because it’s not called or I get a null pointer in my bean.
  But I have done the error handling in the bean so I believe there might be some other reason?</p>
  
  <p>Error 1</p>
  
  <pre><code>    SEVERE: Servlet.service() for servlet [Faces Servlet] in context with path     [/test threw exception [/home/barChart.xhtml @14,67 listener="#{chartBean}": Identity 'chartBean' does not reference a MethodExpression instance, returned type: ChartBean] with root cause
      javax.el.ELException: /home/barChart.xhtml @14,67 listener="#{chartBean}": Identity 'chartBean' does not reference a MethodExpression instance, returned type: ChartBean
          at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:111)
  </code></pre>
  
  <p>Error 2</p>
  
  <pre><code>    SEVERE: Servlet.service() for servlet [Faces Servlet] in context with path [/test] threw exception [null] with root cause
      java.lang.NullPointerException
          at org.primefaces.component.chart.bar.BarChartRenderer.encodeOptions(BarChartRenderer.java:64)
  </code></pre>
  
  <p>Error 3</p>
  
  <pre><code>    SEVERE: Exception sending context initialized event to listener instance of class com.sun.faces.config.ConfigureListener
      java.lang.RuntimeException: java.lang.OutOfMemoryError: PermGen space
          at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:292......
  </code></pre>
  
  <p>And the error are then adding up</p>
  
  <p>The code:
  barChart.xhtml</p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="ISO-8859-1" ?&gt;
      &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
      &lt;html xmlns="http://www.w3.org/1999/xhtml"
              xmlns:ui="http://java.sun.com/jsf/facelets"
              xmlns:h="http://java.sun.com/jsf/html"
              xmlns:f="http://java.sun.com/jsf/core"
              xmlns:p="http://primefaces.org/ui"&gt;
      &lt;h:head&gt;
      &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /&gt;
      &lt;title&gt;Insert title here&lt;/title&gt;
      &lt;/h:head&gt;
      &lt;h:body&gt;
  
  
              &lt;h1 class="title ui-widget-header ui-corner-all"&gt;Login - Statistics&lt;/h1&gt;
              &lt;div class="entry"&gt;
  
                  &lt;p:barChart id="horizontal" value="#{chartBean.categoryModel}" legendPosition="ne"  breakOnNull="false" barMargin="3" barPadding="3"
                              title="Horizontal Bar Chart"  orientation="horizontal" min="0" max="#{chartBean.count}" style="height:#{chartBean.ssize}" /&gt;
  
  
              &lt;/div&gt;
      &lt;/h:body&gt;
      &lt;/html&gt;
  </code></pre>
  
  <p>And the Bean
  ChartBean.java</p>
  
  <pre><code>    @ManagedBean(name="chartBean")
      @RequestScoped
      public class ChartBean implements Serializable {
  
          CDBPool cdb;
          ResultSet res = null;
          private int method = 0;
          private int  months = 12;
          private String  country = null;
          private int bitval = 1;
          private int type = 0;
          private CartesianChartModel categoryModel;
  
          private int size = 1;
          private String sSize = "10";           //Width of chart
          private String maxCount="100";          //size of x-axis 
          private int count = 0;
          private HttpServletRequest request;
          private HttpServletResponse response;
  
          public ChartBean()   {
          request = (HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest();
          response = (HttpServletResponse)FacesContext.getCurrentInstance().getExternalContext().getResponse();
              createCategoryModel();
          }
  
  
      /**
      * To set the max of x-axis as integer
      * @return 
      */
          public int getCount() {
              return count;
          }
  
  
      /**
      * To set the max of x-axis
      * @return 
      */
          public String getMaxCount() {
              return maxCount;
          }
  
          public int getSize() {
              return size;
          }
      /**
      * To set the width of chart
      * @return 
      */
          public String getSsize() {
              return sSize;
          }
  
          public void itemSelect(ItemSelectEvent event) {
              FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_INFO, "Item selected",
                      "Item Index: " + event.getItemIndex() + ", Series Index:" + event.getSeriesIndex());
  
              FacesContext.getCurrentInstance().addMessage(null, msg);
          }
  
          public CartesianChartModel getCategoryModel() {
              return categoryModel;
          }
  
          public final void setChartProp(int method, int  months, String country, int  bitval, int  type){
              //TODO Replace thees values with request get...
              this.method = method;
              this.months = months;
              this.country = country;
              this.bitval = bitval;
              this.type = type;
              if (method == 0) {
                  method = 0;
              }
              if (months == 12) {
                  months = 12;
              }
              if (country == null) {
                  country = "%";
              }
              if (bitval == 1) {
                  bitval = 1;
              }
              if (type == 0) {
                  type = 0;
              }
              //CALL "cdbdba"."CDBStatLoginDay"("@SUMMETHOD" = 0,"@MONTHSBACK" = 12,"@COUNTRY" = '%',"@BITVAL" = '1',"@TYPE" = 0)
      /*
              mint,diff,dh,sum
              20110616,366,0,84
              20110616,366,1,52
              20110616,366,2,6
              20110616,366,3,17
      */      
  
              String sqlString = "Exec CDBStatLoginDay " + method + "," + months + ",'" + country + "'," + bitval + "," + type;
              res = cdb.dbQuery(sqlString);
          }
  
          private void createCategoryModel()  {
              try {
                  cdb = JSPCodeFunctions.getDBPool(request, response);
              } catch (Exception ex) {
                  Logger.getLogger(ChartBean.class.getName().concat(" when calling JSPCodeFunctions ")).log(Level.SEVERE, null, ex);
              }
                  setChartProp(method,  months,  country,  bitval,  type);    
              categoryModel = new CartesianChartModel();
              ChartSeries hits = new ChartSeries();
  
              if (res != null) {
  
                  Date incrementDate = null;
                  DateFormat formatter = new SimpleDateFormat("yyyyMMdd");
                  int days = 0;
                  String day;
                  String month;
                  String year; 
                  String serieDate = null;
                  String startDate = null;
  
                  count = 100;
                  try {
                      while (res.next()) {
                          size = res.getInt(2);
                          try {
                              incrementDate = ChartDate.addDays((Date)formatter.parse( res.getString(1)), res.getInt(3));
                          } catch (ParseException ex) {
                              Logger.getLogger(ChartBean.class.getName().concat(" When retriving rows from res ")).log(Level.SEVERE, null, ex);
                          }
                          day = incrementDate.toString().split(" ")[2];
                          month = incrementDate.toString().split(" ")[1];
                          year = incrementDate.toString().split(" ")[5];
                          serieDate = day+""+month+""+year;
                          count = (res.getInt(4)&gt;count)? res.getInt(4):count;
                          hits.set(serieDate, res.getInt(4));  //Sets date and count
                          days++;
                          try {
                              startDate = ChartDate.addDays((Date)formatter.parse( res.getString(1)), 0).toString().split(" ")[2]+"-"+ChartDate.addDays((Date)formatter.parse( res.getString(1)), 0).toString().split(" ")[1]+"-"+ChartDate.addDays((Date)formatter.parse( res.getString(1)), 0).toString().split(" ")[5];
                          } catch (ParseException ex) {
                              Logger.getLogger(ChartBean.class.getName().concat(" When retriving rows from res")).log(Level.SEVERE, null, ex);
                          }
  
                      }
                      maxCount = String.valueOf(count);
                      sSize= String.valueOf(size*15)+"px";                
                      hits.setLabel("Numer of login from: "+startDate+" to "+serieDate.toString());
                  } catch (SQLException ex) {
                      Logger.getLogger(ChartBean.class.getName()).log(Level.SEVERE, null, ex);
                  }
  
                  try {
                      if (res!=null)res.close();res = null;
                  } catch (SQLException ex) {
                      Logger.getLogger(ChartBean.class.getName()).log(Level.SEVERE, null, ex);
                  }
                  categoryModel.addSeries(hits);
  
  
              }else{
                  //Lets add some default test data
                  ChartSeries boys = new ChartSeries();
                  boys.setLabel("Boys");
                  boys.set("2004", 120);
                  boys.set("2005", 100);
                  ChartSeries girls = new ChartSeries();
                  girls.setLabel("Girls");
                  girls.set("2004", 52);
                  girls.set("2005", 60);
                  categoryModel.addSeries(boys);
                  categoryModel.addSeries(girls);
                  }
          }
  
      }
  </code></pre>