• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Unexpected behavior: Different users sharing session

 
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there,
i have the following issue. When two users access concurrently my application, the managed beans seem to lose their state. I thought this was due to re-initialization of the session managedbeans. So I struggled for a long time to find out for which reason those beans were being reset, and finally found out the problem, the users, although sitting on different computers, are actually sharing the same session id!. So the beans are not being reset automatically, but instead as a result of the application logic itself (when starting a process, I previously set the managedbean's members state to null in order to cleanup resources and prevent malfunction). I found it out by checking the session id value inside a custom PhaseListener, and saw that the two users shared the session object.

So now, on one hand I know what the problem is, but on the other, don't know what actually makes the server manage the creation of a new session. I was 100% sure of the fact that the server would check the origin of requests, and when detecting a new one when comparing with the existing connections, it would create a new session object and bind it to that origin (i.e. IP address?).

So I see myself now involved with the task of manually managing creation and destruction of sessions. And I don't know exactly where to start.
Regarding the problem, does anyone know of a straight solution to the problem? Should I set something in any of the *.xml config files?

Many thanks in advance for your insights.

Carlos.
 
Carlos Conti
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
WAit!

I found the error. In fact there was no session sharing. Don't know why I got the same session ids when checking then the day after went through some tests and the session ids were different. Sorry for that.

My problem was that I was not considering that a custom MyPhaseListener was indeed "static", and that instance was holding a key instance of the managed beans, which triggered update methods. That's why one user was overriding the results of another one. Now I store those key instancees in the session, and it has been solved.

Hope nobody brainstruggled with this issue.
Thanks,
Carlos.
 
reply
    Bookmark Topic Watch Topic
  • New Topic