You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Kevin Dorne <ke...@timbuk2.com> on 2003/05/14 20:49:03 UTC
Error getting request content
I'm using Adobe's FDF tools to read input submit from a PDF form. I use this
code in a servlet to grab the data from the request:
----------
int howMany = req.getContentLength();
byte data[] = new byte[howMany];
int bytesRead = req.getInputStream().read(data);
------------
What's happens, however, is that it only gets part of the data. For example,
"howMany" (content length) may be 4386, but "bytesRead" only gets 3123.
On my development box, both numbers box. When I put it on my live server (the
only real difference is that the live server is dual-CPU), there's the
mismatch above, and of course the code can't do anything useful with the
partial data that it gets.
Now, I have been getting OutOfMemory errors on the live server every few
hours, also something that doesn't happen on my development server. My heap
is set to 512M on both servers. I could see a problem with SSL causing a
problem reading the content of the request, but it's sort of a shot in the
dark.
Any ideas?
(Error below)
java.lang.OutOfMemoryError:
at java.io.ByteArrayOutputStream.<init>(ByteArrayOutputStream.java:71)
at com.sun.net.ssl.internal.ssl.OutputRecord.<init>(DashoA6275)
at com.sun.net.ssl.internal.ssl.HandshakeOutStream.<init>(DashoA6275)
at com.sun.net.ssl.internal.ssl.Handshaker.<init>(DashoA6275)
at com.sun.net.ssl.internal.ssl.ServerHandshaker.<init>(DashoA6275)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.b(DashoA6275)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.d(DashoA6275)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.b(DashoA6275)
at com.sun.net.ssl.internal.ssl.SSLServerSocketImpl.accept(DashoA6275)
at
org.apache.tomcat.util.net.jsse.JSSESocketFactory.acceptSocket(JSSESo
cketFactory.java:240)
at
org.apache.tomcat.util.net.PoolTcpEndpoint.acceptSocket(PoolTcpEndpoi
nt.java:341)
at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java
:497)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadP
ool.java:530)
at java.lang.Thread.run(Thread.java:484)
[ERROR] PoolTcpEndpoint - -Exception in acceptSocket
<java.lang.OutOfMemoryError
: >
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Error getting request content <-- more info
Posted by Kevin Dorne <ke...@timbuk2.com>.
On Wednesday 14 May 2003 15:54, Tim Funk wrote:
> You can get the input stream (or reader) until the first call
> getParameter() is called. After getParameter is called, you won't be able
> to get the InputStream. Its part of the spec (section 4.1.1)
That definitely did it. Our site is quite old (ca 1998) and probably predates
those specs.
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Error getting request content <-- more info
Posted by Tim Funk <fu...@joedog.org>.
You can get the input stream (or reader) until the first call getParameter()
is called. After getParameter is called, you won't be able to get the
InputStream. Its part of the spec (section 4.1.1)
-Tim
Kevin Dorne wrote:
> I'm doing some req.getParameter() and req.getSession() calls before the
> req.getInputStream().read(data) call; could this be why the read is failing
> to get the whole content-length?
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Error getting request content <-- more info
Posted by Kevin Dorne <ke...@timbuk2.com>.
I'm doing some req.getParameter() and req.getSession() calls before the
req.getInputStream().read(data) call; could this be why the read is failing
to get the whole content-length?
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org