title: JSF application crossing user session data
body: <p>I have a difficult JSF issue  I am trying to solve.  Note, I am fairly new to JSF and Java....I have a simple application where users login, select some checkboxes, click submit, add some more info on another page, save to DB and logout.  </p>
  
  <p>In my Production env, I am seeing instances where user session data is getting crossed or cached and pickup by a subsequent user session.  For example, User A enters data, then User B enters data and upon reviewing his data, he sees stuff User A entered.  Of course, I cannot recreate this in test.</p>
  
  <p>I am using jsf 1.2._12, richfaces 3.3.2, and spring 2.5.6.  The app server is JBoss 5. </p>
  
  <p>All of my JSF managed-beans are session scoped. This particular managed bean calls a spring bean as my Business object which is session scoped, which ultimately calls a DAO that is singleton.  </p>
  
  <p>Here the relavant faces-config info</p>
  
  <pre><code>&lt;managed-bean&gt;
      &lt;description&gt;ContactBean&lt;/description&gt;
      &lt;managed-bean-name&gt;ContactBean&lt;/managed-bean-name&gt;
      &lt;managed-bean-class&gt;com.package.ContactBean&lt;/managed-bean-class&gt;
      &lt;managed-bean-scope&gt;session&lt;/managed-bean-scope&gt;
  
      &lt;managed-property&gt;
          &lt;property-name&gt;dataElementBO&lt;/property-name&gt;
          &lt;value&gt;#{dataElementBO}&lt;/value&gt;
      &lt;/managed-property&gt;
  
      &lt;managed-property&gt;
          &lt;property-name&gt;attributeBO&lt;/property-name&gt;
          &lt;value&gt;#{attributeBO}&lt;/value&gt;
      &lt;/managed-property&gt;
  
      &lt;managed-property&gt;
          &lt;property-name&gt;dataElement2BO&lt;/property-name&gt;
          &lt;value&gt;#{dataElement2BO}&lt;/value&gt;
      &lt;/managed-property&gt;
  
      &lt;managed-property&gt;
          &lt;property-name&gt;submissionBO&lt;/property-name&gt;
          &lt;value&gt;#{submissionBO}&lt;/value&gt;
      &lt;/managed-property&gt;
  
      &lt;managed-property&gt;
          &lt;property-name&gt;selectedList&lt;/property-name&gt;
          &lt;property-class&gt;java.util.ArrayList&lt;/property-class&gt;
          &lt;list-entries /&gt;
      &lt;/managed-property&gt;
  
      &lt;managed-property&gt;
          &lt;property-name&gt;enteredContact&lt;/property-name&gt;
          &lt;property-class&gt;java.util.ArrayList&lt;/property-class&gt;
          &lt;list-entries /&gt;
      &lt;/managed-property&gt;
  &lt;/managed-bean&gt;
  </code></pre>
  
  <p>And my app-Context for the spring bean getting called</p>
  
  <pre><code>&lt;bean id="submissionBO" class="com.package.submissionBOImpl" scope="session"&gt;
      &lt;property name="submissionDAO"&gt;
          &lt;ref bean="submissionDAO" /&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>In viewing my webserver logs, this issue occurred when User A and B weren't even logged in at the same time.  User A logged out and then User B logged in almost 20 minutes later.  </p>
  
  <p>I don't understand how the use of session scoped beans could possibly cross in other users data... is there something I don't understand about how these are scoped?  I can attach some mocked up code if needed.  Thanks in advance!  </p>