aspose file tools*
The moose likes Servlets and the fly likes Session error spillover Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Session error spillover" Watch "Session error spillover" New topic
Author

Session error spillover

Chad Clites
Ranch Hand

Joined: Aug 16, 2005
Posts: 134
I have an app that allows users to enter financial data, and then balances are generated on the fly. Each user has their own sessions, and their own private accounts. Every once in awhile a user will be funny and do things like spelling the date which causes an error because the app is expecting a number (which I have since fixed... never underestimate the creativeness of your users).

Anyway, once the error is generated, it throws it for all users, and effectively locks up the system for everybody. Is that a Tomcat issue, or a java issue? It makes sense to me that if an error is thrown in one session, it shouldn't be able to affect other users..
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60050
    
  65

It is almost certainly an issue with your own application code. How exactly are you handling the error?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Chad Clites
Ranch Hand

Joined: Aug 16, 2005
Posts: 134
I figured it was probably my code, but I couldn't see how it was propagating the error across all users.I wasn't catching an error at all because I thought I had all potential inputs covered.

If I am taking your question correctly, the method that reads my input should be catching the errors?

EDIT: To clarify, when it did detect input that didn't pass the checks I had put in place, an error page displayed. If the input made it past those checks due to my lack of foresight, there was nothing to catch it.
[ May 16, 2006: Message edited by: Chad Clites ]
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

If an input error on one user's part is causing errors in other user's sessions, there is a good chance that your apps structure has some serious flaws.

Are you relying on instance variables, singletons, or context scoped objects in your app? If so, can you describe how you're using them?


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Jeroen T Wenting
Ranch Hand

Joined: Apr 21, 2006
Posts: 1847
sounds almost like a static variable in a JSP is being set by one instance causing all instances to see it when next they're called.


42
Chad Clites
Ranch Hand

Joined: Aug 16, 2005
Posts: 134
This is the code that is causing the error:

I'm not sure if this is enough code, but this is the part that is causing the error; specifically when parsing the string to an int. This snippet is to check if a date falls within a specific range, and if it does, tick a counter
[ May 16, 2006: Message edited by: Chad Clites ]
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410



How are you creating and where are you storing the ledger variable?
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Also the old and counter variables; how are they being declared and stored?
Chad Clites
Ranch Hand

Joined: Aug 16, 2005
Posts: 134
ledger is declared globally: ArrayList ledger = new ArrayList();
counter is declared right before the loop (locally): int counter = 0;
old is global also. I can't think right now why I did it that way, because it really only needs to be local.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Session error spillover
 
Similar Threads
Basic question about request and session
Put collection object into session
Using both BASIC and FORM authentication for different sections of same web application
Applet Red X and Class not found Error
WSDL question