my dog learned polymorphism*
The moose likes JSF and the fly likes The glassfish session failed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "The glassfish session failed" Watch "The glassfish session failed" New topic
Author

The glassfish session failed

Pawel Skadorwa
Greenhorn

Joined: Sep 16, 2012
Posts: 4
Hello Everybody,

There is a problem with glassfish session and I don't really know how to resolve it. I developed JSF application based on JSF 2.1 and noticed strange feature. When the app was tested by many users in the same time, they could see their data given in the inputtexts. Another words when one of them retrieved data into a form, the other who open the same form was able to read that data. Can it be a problem with session? I didn't notice a jsessionid in URL. Please give me some tips that will help me to solve that problem. Thank you very much in advance.
Brendan Healey
Ranch Hand

Joined: May 12, 2009
Posts: 218

By default JSF uses a jsessionid cookie in preference to URL rewriting. It sounds like your users are somehow connecting to the
same session, are you using @SessionScoped backing beans? Are they connecting up from the same browser or using different
computers? Are cookies enabled on the browsers?
Pawel Skadorwa
Greenhorn

Joined: Sep 16, 2012
Posts: 4
Exactly it seems to be the same session. They use different computers, are connecting from different locations, cookies are enabled but if it comes to the session scope it looks like this:



Everything looks as if it was correct but it doesn't work. I don't have any idea how to repair it. Have you got any idea about the reason of such behaviour.
I want to add that I use xhtml pages and web.xml looks like this:

Pawel Skadorwa
Greenhorn

Joined: Sep 16, 2012
Posts: 4
It happens when I use static variables. When I want to use only public then data isn't displayed. Any ideas?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15960
    
  19

Pawel Skadorwa wrote:It happens when I use static variables. When I want to use only public then data isn't displayed. Any ideas?


Yes. Do not use static variables. By definition, static variables belong to the class, not to the instance and there's only one set of them no matter how many instances of the class may exist.

That's not even JSF-specific. It's fundamental Java.


Customer surveys are for companies who didn't pay proper attention to begin with.
Pawel Skadorwa
Greenhorn

Joined: Sep 16, 2012
Posts: 4
You are right! The problem has been solved. Static variables caused such a mistake. Thank you very much for your help. I appreciate it.


Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15960
    
  19

Some people would argue that static variables should never be used in J2EE apps - that truly shared objects should be placed in Application Scope, instead.

I'm not that hot for mindless ideology myself, but I do prefer not to use them. In any event, shared objects should only be accessed in a thread-safe way, since J2EE is a heavily multi-threaded environment.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: The glassfish session failed
 
Similar Threads
After logout in JSF relogin withtout credentials possible
Authirization Filter Problem
JSF 2.0 GlassFish 3.0.1 problem
How to populate a form from a tree node
Resolve f:param value at link construction time