File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes How can I increase the size of the session variables? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "How can I increase the size of the session variables?" Watch "How can I increase the size of the session variables?" New topic
Author

How can I increase the size of the session variables?

Ricardo Alvarado
Greenhorn

Joined: Feb 23, 2004
Posts: 19
Currently I need to store up to 80 Kb in a session variable and it seems that I kind of lost the session variable. I'm pretty sure that the reason of this is that the server on which my application is install has some sort of session variable maximum.
Do someone know where can I check this, or how can I increase this..

I'll really appreciate all you help

Thank you very much....
scott dawson
Greenhorn

Joined: Jun 30, 2003
Posts: 18
Are you really sure that's what you want to do? Are you talking about adding an 80k variable to the session object?
I obviously don't know your application, but it seems like having every session object carrying around a potential 80k is a real good way to kill the server or at least degrade performance.
I'm no expert, but I'd really look to see if there is another way of doing this.
Ricardo Alvarado
Greenhorn

Joined: Feb 23, 2004
Posts: 19
Lets say its a smaller type of session object. I'm still loosing my session variable from one page to another even if we are talking of 1/2Kb or less. The weird thing is that I'm not loosing the others variables.
I have tested this application in other servers and it seems to be ok, but in this server doesn't quite follow with the session variables. Now, I think it can be a server issue but I'm not sure where to look.
So as you see, the server is loosing an specific session variable.
Does the session variables has a maximum definition name, or in an application can you place a maximum set of variables?

Thank you very much :0
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

Whew, for a second there I thought this post was like all those spam e-mails that I get.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12786
    
    5
Does the session variables has a maximum definition name, or in an application can you place a maximum set of variables?

Not usually - the session object is mainly a collection that stores references to objects by name.
Is the object you are losing Serializable? If not the servlet engine may be losing it on serializing the session to disk. In that case you should see error reports in the logs.
Which servlet engine are you using?
Bill
Ricardo Alvarado
Greenhorn

Joined: Feb 23, 2004
Posts: 19
I'm using WebSphere Application Server 4.x

I found other inusual thing. I am storing my session id in a database and it seems that on every page that I go within my applicaction (in the same window browser) seems to be changing. So I have a different session id for each page. It's seems to me that I'm loosing the session but I'm not sure what I could do for storying it...

Thanks
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12786
    
    5
There is no good reason to store your session ID in a database - the servlet container is responsible for managing the session ID and it uses its own rules for where that ID is meaningful.
I can think of the following possible reasons for getting different sessions during the same browser session:
1. code somewhere is forcing an existing session to be invalidated
2. the server does not consider all the parts of your application to be the same "web application"
3. your session timeout is set to a short duration and the container is timing it out.
Bill
Ricardo Alvarado
Greenhorn

Joined: Feb 23, 2004
Posts: 19
Thanks Bill

I'm only storying this sessions for testing.

To your suggestions...
I will take a look to the code, do you
think that some null values in session
variables can do this. What else can invalidate a session?.

The second one "the server does not consider all parts of your application to be the same web application", how can I look for this, is there a configuration file that I should be looking?

The third one I'm not really sure where the timing for the sessions is set; where are this configuration files? or its a server kind of issue.

I really appreciate your help..

Thanks a lot...

Ricardo
Sanjeev Kaushik
Ranch Hand

Joined: Aug 01, 2002
Posts: 105
If you are getting a new session id from each page from the same user, in that case server is not able to understand that requests are coming from the same user. How server understands if the request is coming from the same user?

In the very first request, server creates new session object and while sending the response back to browser, it also sends the session id in the HTTP headers. If the cookies in the browers are enabled, this session ID comes back in the HTTP headers of next request. Server verifies this id with the already generated IDs. If there is no match of this id then it creates fresh or if there is matching then it returns the already created session object.

This problem can be solved by using URL re-writing. It appends the session id in each dyamic URL.

Try this, it may solve your problem.


Sanjeev Kaushik
Ricardo Alvarado
Greenhorn

Joined: Feb 23, 2004
Posts: 19
I could fix the problem.. thank you very much..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How can I increase the size of the session variables?