Re: tomcat output gets mixed up for different requests

2004-08-03 Thread André Weidemann
QM wrote:
Two clients' content getting mixed up with one another: sounds like
misuse of a shared variable, such as an instance variable inside the
servlet class, use of the servlet context for client data, etc.
I checked all variables and declarations and I'm sure that there are no
variables being misused.
For debugging purposes I added a System.out(this); at the beginning of
the doGet() method of the servlet class.
No matter which client is calling the servlet, the output of
System.out(this); is always the same. The output looks like this:
[EMAIL PROTECTED]
So it seems that Tomcat does not spawn a new servlet for a new request,
althought my web.xml file contains:
servlet
servlet-nameNavigation/servlet-name
servlet-classNavigation/servlet-class
load-on-startup5/load-on-startup
/servlet
With every client calling the same Method it seems very likely that the
output is getting mixed up.
Adding a *synchronized* in front of the doGet() method, makes the
problem disappear, but also makes the Tomcat very slow.
Any help will be greatly appreciated,
 André.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: tomcat output gets mixed up for different requests

2004-08-03 Thread André Weidemann
Caldarale, Charles R wrote:
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Subject: Re: tomcat output gets mixed up for different requests
So it seems that Tomcat does not spawn a new servlet for a 
new request

As per the spec - using a single instance of the servlet is correct behavior.  You 
should be using local variables, not instance or static fields, within the servlet.  
If you need to save some persistent information, the session is frequently the right 
place to put it.
 - Chuck
I was able to fix the error, it was one of those stupid mistakes...
It wasn't a static variable but close to it. I had PrintWriter for the 
response.getWriter specified as a class-variable.
It is working flawlessly now.

 André.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


tomcat output gets mixed up for different requests

2004-07-09 Thread André Weidemann
Hi,
I searched the net and also the tomcat-list archives but couldn't find 
any help. That is what lead me here...

I'm quite new to Tomcat and Java. I'm using Tomcat 3.3.2 and Java 1.4.2 
under Linux.

I have the following problem:
I have an application that reads from a mysql database and an openldap 
sever. There are two classes for navigation and then my htmlgenerator 
class generates all the output while the ldap and mysql class retrieve 
all the information necessary.

My problem is that as soon as two clients are accessing the tomcat 
server simultaniously, the output is sometimes split up between the 
clients. In that case, one client lacks page content, which the other 
one will receive instead. So the first has too few lines on his page and 
the other one has additional lines that were not ment for him.

I know that it is quite hard to tell without the source code, but does 
anyone have a slight idea what could be the cause for this?

André.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]