I've been working on this issue for a couple of days and i cannot come up with a good explanation for it.
Well the issue is this:
I have a url which forwards to a particular page having two particular variables (a & b). These variables are stored using:
request.getSession().setAttribute("a", a);
Then when the user tries to join on the site those variables are retrieved to be used with registration:
request.getSession().getAttribute("a");
The thing is that the attribute is null! The session id in both cases is the same.
The funny thing is that if i try it locally is works. But when i load it onto our servers it doesn't. The only minimal explanation i can get is that the servers are divided and from the time i set the attributes to the time i get the attributes the server changes so maybe the session values are lost there!
Any explanation from your side guys? if so any solutions you can provide me with?
It sounds like the servers might be load balance or something.
Look into setting a sticky bit or something (WAS or some other app server configuration) OR there is a way to force all responses from each session to come from the same server in a load balanced environment.
I know our deployment department has set this for our apps. We have 2 prod / 2 DR servers.
Hi Thomas..the server is sticky so it shouldn't be a problem.
As regards to it being serializable...well the variable 'a' is a String!
The other thing that i noticed was that it looses the session when moving from http to https. Since the registration is on a https server i cannot change it. When i temporarily changed it to an Non secure server everything worked fine!
The other thing that i noticed was that it looses the session when moving from http to https. Since the registration is on a https server i cannot change it. When i temporarily changed it to an Non secure server everything worked fine!
That's normal and by design. Sessions created under SSL should be separate from non-secure ones. This helps to prevent session hi-jacking.