tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alan Chaney <>
Subject Re: Tomcat Internal Buffering with Jython
Date Sun, 15 Feb 2009 17:07:17 GMT
Hi Prashant

So the exact problem is that after your jsp page is called and the data 
processed then the file is incomplete?
Presumably then you are using ordinary file I/O to write to this file? 
If that's the case, then I think the answer to your original question is 
"No - no internal buffer of tomcat is holding the data"

Tomcat's buffering is connected with processing servlet 
request/responses and it doesn't seem that you are using the response 
object to write your data to the output stream. I assume that you have 
checked that all of the data is being read from the request by some 
logging or debugging?

I would suspect that a file or stream is not being flushed/closed and 
that when tomcat is stopped this flushing is happening because the 
streams are being closed automatically.

Maybe you can create some unit tests which can help isolate this 
problem. It may be either in your file writing code or in the way you 
are using the jython libraries. Without seeing your code in detail its 
difficult to be more helpful. I'd guess that you could take your core 
logic and replicate the problem independently of tomcat.

One other point is that saving this file in the tomcat home directory 
doesn't seem particularly elegant. You could use the default work 
directory. I doubt that has any relevance to the problem



Prashant Golash wrote:
> Hi Alan,
> Below are the details for the versions and OS:
> Tomcat Version : 6.0
> OS : Windows XP
> JVM : 1.6
> The way web is structured is:
> I have some precompiled python scripts which are actually compiled by jython
> into java classes(Before deploying).
> I have one python script which uses these precompiled python classes.Now I
> am giving one file as
> input to this python script and it internally produces the output file using
> this input file.
> This output file is saved locally in the parent directory of Tomcat.
> There is one jsp page which takes input from the user and then passes the
> request to Java class which actually
> calls this Python script.
> Note:The python script is actually called using the PythonInterpreter class
> and all those Java and Jython integration techniques.
> Sincerely,
> Prashant golash
> On Sun, Feb 15, 2009 at 10:02 PM, Alan Chaney
> <>wrote:
>> Hi Prashant
>> The first question - which version of Tomcat? What operating sytem? What
>> JVM? and in your case which version of Jython?
>> Secondly please could you clarify exactly how your web is structured?
>> My understanding from your first email is:
>> 1. servlet is called with request containing a file (presumably mutlipart
>> encoded?)
>> 2. the file data is then fed into a python script running either using a
>> java6 ScriptManager or similar.
>> 3. and then what? Are you streaming the output from that file straigth into
>> the PrintWriter/OutputStream of the HttpServeltResponse?
>> Or are you trying to save the file locally?
>> Regards
>> Alan Chaney
>> Prashant Golash wrote:
>>> Hi Tomcat-Apache Gurus,
>>> I have a web application where  from the front end user loads a file
>>> and gives it as input to Java classes.The file is given as input to
>>> a python script which converts it into some other format.
>>> Here I have used the concept of jython.
>>> The file is converting properly in the parent
>>> directory of Tomat but with some of the data which is missed.The problem
>>> is
>>> when I close the tomcat,then additional data is added to the converted
>>> file
>>> which
>>> completes the correct conversion.
>>> I want to know whether some internal buffer of Tomcat is holding the extra
>>> data.
>>> If so how to retrieve it.
>>> Sincerely,
>>> Prashant golash
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:
>> For additional commands, e-mail:
> !DSPAM:49984b33117283966023671!

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message