title: PrimeFaces <p:poll> refresh invalidates backing bean member if bean ViewScoped
body: <p>I am using PrimeFaces UI library and JSF 2. </p>
  
  <p>I have a backing bean: </p>
  
  <pre><code>public class JobMgmtBean extends ClientBeanBase implements Serializable
  </code></pre>
  
  <p>and </p>
  
  <pre><code>public class ClientBeanBase extends BeanBase
  </code></pre>
  
  <p>(so inheritance is <code>JobMgmtBean:ClientBeanBase:BeanBase</code>).</p>
  
  <p>I wanted to set my <code>JobMgmtBean</code> from request scoped to view scoped, but after a while my <code>sessionVars</code> which is defined in <code>BeanBase</code> <strong>becomes null</strong> and the bean is not functional anymore.</p>
  
  <p>I initialize <code>sessionVars</code> in the <code>BeanBase</code> like this:</p>
  
  <pre><code>protected Map&lt;String,Object&gt; sessionVars = null;
  
  ex = FacesContext.getCurrentInstance().getExternalContext();
  sessionVars = ex.getSessionMap();
  </code></pre>
  
  <p>I refresh some of my PrimeFaces UI components on the page every 5 seconds (using <code>&lt;p:poll interval="5"...&gt;</code>), and after a few refreshes <code>sessionVars</code> becomes null.</p>
  
  <p>Why does this happen? </p>