Question

we have a JavaEE Web application that runs on Tomcat5 server (jsp, java and extjs are used on development of this tool).

We observe sometimes, particularly when the application is highly used, that some session variables or interface fields are mixed up in servlets.

This means that : when one user connects, his parameters are kept in the sessions.

After an update or insertion of data in the database ORACLE,the system returns the name of another user who was probably connected at the same time on a different navigator or a different computer. Others times the request.getparameter gets a values from different clients or user interfaces. Thank you to help me fix this problem.

Was it helpful?

Solution 2

I've finally understood how servlet.java works. I works like main process that create a thread for any call thus, all attributes of such class are common to all thread and we are not sure of the result that we get when accessing them.

If we want any client to use those variables in a private context, we must put them in the function "doGet" or "doPost" as local variables.

My problem have them been solved

OTHER TIPS

The only way for this to happen is if you have a singleton somewhere that keeps track of the session and for some reason this singleton is mixing up the variables between sessions.

You can try this: Instead of differentiating a user only by its credentials (assuming you are not using Federation), return a token, unique amongst all sessions to the user logging in, and make the user send that unique id with every request. This way you will be able to differentiate the request/responses even if the user logs in using many different browsers.

But again, this will only happen when you do something like having a singleton connecting the session, by itself the session would not exchange variables amongst them.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top