This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
Am developing a web application based on spring web MVC framework that runs in in tomcat server. The entry to the webapp is through a login page and after successful validation user is taken to home page that displays a greeting message like Good Morning Mr XYZ. The user name is set as session attribute from Login Servlet and is retrieved by the home page JSP. During load testing it was noticed that the user name displayed in greeting message was of some other user. This problem occurred only twice and is not reproducible. What could be the cause of this issue? Should I put the login code in synchronize block so there are no threading issues? Thanks, Kapil
Originally posted by kapil Gupta: Yes, there are not instance variables in servlets other than the singleton spring beans (service classes) that further validates the user from database.
That sounds like it could be a problem. If you have a singleton object (shared by all requests) with instance variables, then it's to be expected that multiple requests could be sharing the same variables.