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]


RE: tomcat output gets mixed up for different requests

2004-08-03 Thread Caldarale, Charles R
> 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


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and 
is thus for use only by the intended recipient. If you received this in error, please 
contact the sender and delete the e-mail and its attachments from all computers.

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



AW: tomcat output gets mixed up for different requests

2004-08-03 Thread SH Solutions
Hi

> So it seems that Tomcat does not spawn a new servlet for a new request,
althought my web.xml file contains:
> 
>  Navigation
>  Navigation
>  5
> 

Load-on-startup lets you set initialization ORDER, not instance COUNT.

It is totally up to tomcat, how many instances of the servlet are created.
At least one is. Maybe more, maybe only one.
This might also change between versions.

Do not use "synchronized" doXXX methods. Use local variables.

Regards,
  Steffen


-
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 Ralph Einfeldt

It is normal that one servlet is used for several requests.

It's your responsability to write the method thread safe.
As long as you just use local vars inside the method
there will bo no intermixed content. As soon as you start 
to use instance or class variables you may get problems.


> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, August 03, 2004 11:01 AM
> To: Tomcat Users List
> 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, althought my web.xml file contains:
> 

> 
> 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.
> 

-
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
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:

Navigation
Navigation
5

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-07-09 Thread Bill Barker
Are you using Tomcat standalone or mod_jk(2)?  Which Connector are you
using? There was a bug a long while back where mod_jk (and possibly mod_jk2)
would cause something like this if you were accessing the site through a
proxy server.

"André Weidemann" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> 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]



Re: tomcat output gets mixed up for different requests

2004-07-09 Thread QM
On Fri, Jul 09, 2004 at 01:26:45PM +0200, Andr? Weidemann wrote:
: 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.


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.

-QM

-- 

software  -- http://www.brandxdev.net
tech news -- http://www.RoarNetworX.com


-
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]