I work with Eclipse Mars.2, the system has Java 1.8 update 102 for 64bits but this project uses Java 1.7, JSF Mojarra 2.2, Primefaces 6.0 and Tomcat 7.0.53/7.0.54/8.0.1/8.0.11.
I have created the smallest test project in order to show the problem, and ALL its files will be copied following this description.
The test project consist of 2 pages created with templates, with a menubar on top to browse and a selectOneMenu also on top to select the current language.
The current language is stored in a variable in a session bean which is used in both pages and is refreshed every time we change the selectOneMenu.
When I run the APP on Tomcat 7.0.53 / Tomcat 8.0.1 or lesser versions it works percfectly, the SessionScoped bean is created just once and the value is kept correctly stored.
The problem happens when I run the same APP in Tomcat 7.0.54 / Tomcat 8.0.11 or later versions, in such case the SessionScoped bean is created everytime it is used, and as the current language value is initialized it is always set to the default ( english ).
I have researched a lot and asked in several sites but without any luck.
Maybe someone can iluminate me?
Thanks a lot in advance!!
Sorry. The only way I'd be plodding through a raw code dump like that is if someone was paying me full salary. Not many other people would either. Please simplify before posting stuff like this. If it can't all fit on one screen, the odds that you'll get an answer drop significantly.
I can tell you this. A Session scoped bean is simply a Serializable POJO that either your program logic or JSF's Managed Bean subsystem constructs and then stores under a name in the HttpSession object map. Since the name is the item key, that means that one and only one object of that name can exist for the session. Any object previously stored under that name will therefore become de-referenced, and if nothing else references it, will be eligible for garbage collection.
JSF will not construct a session object if the object already exists. Session-scoped objects are not automatically removed from the session. For that, you'd need View Scope. So the logical conclusion is that you yourself are doing something that removes the bean from the session.
Bjoke: A "Bully Joke". A Statement or action made with malicious intent - unless challenged. At which point it magically transforms into "I was just funnin'" or "What's the matter, can't take a joke?"
Thanks a lot for your suggestions!
I think that I will re-post this issue with a lot less code.
Regarding the idea of me performing some action that removes the sessionscoped bean from HTTP session, it sounds logical to me but I don't perform (on purpose) any action to do that...
Thanks a lot, really!
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop