Re: AW: AW: AW: java.io.IOException: Stream closed

2008-12-14 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Stefan,

Schuster Stefan wrote:
> As far as I can tell, the XML-Beans generated code works well - even if
> The stream is closed after reading, this should be no problem as the next
> request will submit a new stream, right?

Yes, your servlet can close an input stream when it's done reading (even
if the request is one of several keep-alive requests). You better make
sure you're done reading it, though ;)

Generally, I don't ever close servlet input streams (or readers). The
container will clean up after input streams after the request processing
has been completed by your servlet. I find that such cleanup adds
confusion to your servlet code and doesn't add any benefit.

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAklFJRgACgkQ9CaO5/Lv0PCI1ACeJIKLuvS28oyEvlku55jiAf4+
0Y0An0nwvNMKdlq3qPQsrl+oKilOVI7O
=goca
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



AW: AW: AW: java.io.IOException: Stream closed

2008-12-11 Thread Schuster Stefan
Hi,

sorry for the long delay - I needed some time away from tomcat and XML ;)
The client is XCelsius (an MS Excel extension that can be used to
access webservices and read XML files from web resources).

As far as I can tell, the XML-Beans generated code works well - even if
The stream is closed after reading, this should be no problem as the next
request will submit a new stream, right?

I will rework the servlet to use a reader, I let you know if that fixes the
Problem.

Thanks for your suggestions,

Stefan

-Ursprüngliche Nachricht-
Von: Christopher Schultz [mailto:[EMAIL PROTECTED] 
Gesendet: Freitag, 5. Dezember 2008 17:43
An: Tomcat Users List
Betreff: Re: AW: AW: java.io.IOException: Stream closed

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Stefan,

Schuster Stefan wrote:
> The code reading the stream is generated by XMLBeans. 
> 
> Is there something that I should not do with the stream? For example
> closing it or something like that?

You shouldn't have to do anything like that.

> <<>>
>   inDoc = DataDocument.Factory.parse(is, xmlOptions);
> <<>>

Looks reasonable to me. Does DataDocument.Factory.parse() do anything
weird like close the stream and then try to read from it again?

Your problem is probably caused by one of two things:

1. Some code stupidly closes the input stream, then tries reading
   from it later

2. The client didn't send enough data

I wonder if there's a character encoding problem, here. You are using an
InputStream from the request and not a Reader, so the Content-Type
encoding from the request is being ignored. If the XML processing
instruction includes an "encoding" parameter, this might be okay, but
I've seen XML documents saying one type of encoding while the actual
encoding is something else (whoops!).

What client are you using to submit this data to the servlet?

Also, what Connector are you using in Tomcat? AJP? HTTP? Nio?

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkk5WhMACgkQ9CaO5/Lv0PCfSwCfef6s6a3meZROUFiJsGBEgSgx
zbgAn1bOUSVVikoGJLNy3Dvgot0bHCoR
=rJcd
-END PGP SIGNATURE-

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


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