We have developed a web application in JSP and tested it in Apache Tomcat 4.0.6. It works absolutely normal when single user accesses the system. We get problems when multiple users (say 17 users simultaneously) access the system. When a user tries to view his data, it shows the information of some other user. Can anybody tell me what could have gone wrong?
Thanx in advance,
It's hard to tell from that little information, but I'd guess you keep the user data in some central place, instead of user specific location (like the session).
You should also check if your application carefully uses 'application' scope.
Not sure where you are storing client data - it should be in the client session.
For debugging purposes you also might want to make the JSP single threaded, i.e.:
<%@ page isThreadSafe="false" %>
This should at least tell you if a lack of thread safety is responsible for the issue you are seeing.
Thanks for ur response. But we haven't used Application scope variables/objects...
I see two common problems, which may lead to this situation:
1. lack of understanding of the servlet/jsp programming model. This especially includes the servlet lifecycle and the attribute scopes. Make sure that your developers understand the differences between application, session and request scope for attributes. Also any use of servlet instance variables should be cause for alarm and if they are modified during a request there should be red lights and sirens going off!
2. Improper use of singletons. The singleton pattern is easy to understand and implement, but often difficult to get working correctly in a J2EE environment. If you use singletons, make sure you have extensive knowledge on the classloaders used in your application server!
Just my 0.2 Dkr.