This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes Problem with session management Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Problem with session management" Watch "Problem with session management" New topic
Author

Problem with session management

Rizwan Mohammad
Ranch Hand

Joined: Sep 02, 2005
Posts: 445
Hi,
When I login into some web application(with websphere) and capturing user id and putting that user info into session. It works well for one browser. If I open another browser and log into the application, instead of creating new session, my server is overriding existing session with new user.
What can be possible reasons for this?


Rizwan
SCJA, SCJP, SCWCD, SCBCD, SCDJWS.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60752
    
  65

If the browser instances share cookies, the sessions will be shared.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Rizwan Mohammad
Ranch Hand

Joined: Sep 02, 2005
Posts: 445
How do I know whether browser instances share cookie or not? Is there any way to set this from browser?
Interestingly this happens only in my real websphere server not from my local machine test server. Is this setting should be set from server side?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60752
    
  65

No, there is no server-side setting. The browsers each have there own rules about cookie sharing.

IE, for example, will share cookeies amongst all instance spawned from a window (either through window.open, or the user using ^N or the File menu). Instance created from the desktop icon or strat menu will not. Go figure.
Rizwan Mohammad
Ranch Hand

Joined: Sep 02, 2005
Posts: 445
Thats what I thought initially. But it is sharing same session even though IE is creted newly from start menu.Any idea why it is happening?
Rizwan Mohammad
Ranch Hand

Joined: Sep 02, 2005
Posts: 445
From different browser instances it gives different JSESSIONID cookie but they have same session id(request.getSession.getID()). First IE returns session as new but second instance returns sesssion as old(session.isNew() == false).
What are the scenarios, in which this case can happen?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with session management
 
Similar Threads
Session Problem
Issue in session manegement
Servlet Sessions Coding
How to maintain Session in Swing application using StatefulsessionBean
Regarding session timeout