You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by da...@gmx.net on 2006/11/30 17:27:36 UTC

problems to deserialize a stream on the client

hello,

I have problems to deserialize a stream on the client.

I tryed to serialize the object to a file.
Copied the file 'manual' to the client 
and the deserilisation was fine.

The same with a stream over the network failed.
Look like the first parts of the file will be
copied over but than the copy stops with the
following exception:


2006-11-30 17:24:37,521 DEBUG [AWT-EventQueue-0]
   org.apache.commons.httpclient.HttpMethodBase:
       Resorting to protocol  version default close connection policy
2006-11-30 17:24:37,521 DEBUG [AWT-EventQueue-0]
   org.apache.commons.httpclient.HttpMethodBase:
       Should NOT close connection, using HTTP/1.1
2006-11-30 17:24:37,521 DEBUG [AWT-EventQueue-0]
     org.apache.commons.httpclient.HttpConnection:
         Releasing connection back to connection manager.

java.io.EOFException
	at java.io.ObjectInputStream$BlockDataInputStream.peekByte(ObjectInputStream.java:2435)
	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1245)
	at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1845)
	at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1769)
	at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
 


I am using "application/octet-stream" is this ok?
Maybe something runs out of memory ?

thanks for help,

bastian
-- 
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! 
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


Re: Re: deserialize bigger objects with ObjectInputstream on the client failed

Posted by da...@gmx.net.
Thanks a lot for your help, the problem is solved.
There were new wrong libaries at the tomcat
that caused the problem.


bastian


----

-------- Original-Nachricht --------
Datum:  Mon, 04 Dec 2006 17:15:22 +0100
Von: Roland Weber <ht...@dubioso.net>
An: HttpClient User Discussion <ht...@jakarta.apache.org>
Betreff:  Re: deserialize bigger objects with ObjectInputstream on the client failed

> Hello Bastian,
> 
> the HTTP protocol has no known problems with larger files
> (less than 2 GB), nor has HttpClient. Please try to narrow
> down the problem to see whether it is on the transport layer
> or above.
> - check whether the server sends a Content-Encoding header
> - generate a binary file on the server
> - deserialize the file on the client to verify it's consistency
>   and the client environment (that's what you've done)
> - let the client read the data from the server and, instead
>   of deserializing it, write it to a file
> - compare the file downloaded by the client with the one
>   generated by the server
> 
> We need more information to help you. The exception is of
> no use at all, it only tells us that an object can't be
> deserialized. It doesn't tell us where the problem comes
> from, and it is in no way related to HttpClient.
> 
> cheers,
>   Roland
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-user-help@jakarta.apache.org

-- 
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! 
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


Re: deserialize bigger objects with ObjectInputstream on the client failed

Posted by Roland Weber <ht...@dubioso.net>.
Hello Bastian,

the HTTP protocol has no known problems with larger files
(less than 2 GB), nor has HttpClient. Please try to narrow
down the problem to see whether it is on the transport layer
or above.
- check whether the server sends a Content-Encoding header
- generate a binary file on the server
- deserialize the file on the client to verify it's consistency
  and the client environment (that's what you've done)
- let the client read the data from the server and, instead
  of deserializing it, write it to a file
- compare the file downloaded by the client with the one
  generated by the server

We need more information to help you. The exception is of
no use at all, it only tells us that an object can't be
deserialized. It doesn't tell us where the problem comes
from, and it is in no way related to HttpClient.

cheers,
  Roland

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


deserialize bigger objects with ObjectInputstream on the client failed

Posted by da...@gmx.net.
hi all,

I try to deserialize an Objectstream at the client.
Smaller Objects working fine, but bigger Objects
let the client abort the connection with the
following exception messsage :

  // first there come some data like the first line
  // and than the stream corrupt by something
[0x1][0xf]M[0xdb][0xae][0xe0][0x0][0x0][0x0][0x0][0x0][0x0][0x0][0x0][0x0]t[0x0][0x5]test4t[0x0].\folder1\file\test12\test10\test9\test7\test4\sq[0x0]~"
java.io.StreamCorruptedException
	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1301)
	at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1845)
	at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1769)
	at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
	at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)
	at java.util.ArrayList.readObject(ArrayList.java:554)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

(1) I serialize the data to a file, copy manual and deserialze,
    everything was fine.

(2) The data is a kind of directory list in an Object.
    I copied the directories that worked fine to subdirectories
    to create a bigger objects with the same chars.
    The stream with the bigger objects failed during the transfer.

It must have something to do with the size of the Object I want to
deserialize.


Maybe someone has a hint why the transfer occurs after a while?

thanks,

bastian
-- 
"Ein Herz für Kinder" - Ihre Spende hilft! Aktion: www.deutschlandsegelt.de
Unser Dankeschön: Ihr Name auf dem Segel der 1. deutschen America's Cup-Yacht!

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


Re: problems to deserialize a stream on the client

Posted by Roland Weber <ht...@dubioso.net>.
Hello Bastian,

> I can see in the logs how the data "blocks"
> will transfered, but after a while the
> transfer break. At least before it stop it
> shows the following logs:
> ---------------------------------------------------------------------
> 2006-12-01 12:03:50,952 DEBUG [AWT-EventQueue-0]
>     org.apache.commons.httpclient.HttpMethodBase:
>         Resorting to protocol version default close connection policy
> 2006-12-01 12:03:50,952 DEBUG [AWT-EventQueue-0]
>     org.apache.commons.httpclient.HttpMethodBase: 
>         Should NOT close connection, using HTTP/1.1
> 2006-12-01 12:03:50,952 DEBUG [AWT-EventQueue-0] 
>     org.apache.commons.httpclient.HttpConnection:
>         Releasing connection back to connection manager.
> ---------------------------------------------------------------------

These are perfectly normal log messages you will see
whenever HttpClient believes to have received the
full response.

> Maybe the postMethod is not able to transfer huge data
> without some special buffering that I forgot to implement?

No. There should not be any problems with file sizes
below 2 gigabyte.

> Or maybe it is a server problem
> ---------------------------------------------------------------------
> 2006-12-01 12:03:50,945 DEBUG [AWT-EventQueue-0]
>     httpclient.wire.content: << 
>         "    The server is temporarily unable to service your[\n]"
> 2006-12-01 12:03:50,946 DEBUG [AWT-EventQueue-0]
>     httpclient.wire.content: <<
>         "    request due to maintenance downtime or capacity[\n]"
> 2006-12-01 12:03:50,946 DEBUG [AWT-EventQueue-0] 
>     httpclient.wire.content: << 
>         "    problems. Please try again later. [\n]"
> ---------------------------------------------------------------------

Well, this is a very precise error message from the server.
It is taken down for maintenance or overloaded. Or else the
server doesn't like your request for some other reason and
just sends a wrong error page?


> Have I to set a charset for application/octet-stream ?

No, charset is only needed for character based formats.

cheers,
  Roland


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


charset for application/octet-stream ?

Posted by da...@gmx.net.
hello,

Have I to set a charset for application/octet-stream ?


-- 
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! 
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


Re: problems to deserialize a stream on the client

Posted by da...@gmx.net.
Hello Roland,

There is no  java.io.EOFException anymore, I 
forgot to flush the stream at the server.

For a smaller Object everything is working fine now,
but with lager objects I got problems.

I wrote everything to a file and did not
deserialize it, but the same error ocurred.

I can see in the logs how the data "blocks"
will transfered, but after a while the
transfer break. At least before it stop it
shows the following logs:
---------------------------------------------------------------------
2006-12-01 12:03:50,952 DEBUG [AWT-EventQueue-0]
    org.apache.commons.httpclient.HttpMethodBase:
        Resorting to protocol version default close connection policy
2006-12-01 12:03:50,952 DEBUG [AWT-EventQueue-0]
    org.apache.commons.httpclient.HttpMethodBase: 
        Should NOT close connection, using HTTP/1.1
2006-12-01 12:03:50,952 DEBUG [AWT-EventQueue-0] 
    org.apache.commons.httpclient.HttpConnection:
        Releasing connection back to connection manager.
---------------------------------------------------------------------

Maybe the postMethod is not able to transfer huge data
without some special buffering that I forgot to implement?


The server shows the following exception in the log:
---------------------------------------------------------------------
ClientAbortException:  java.io.IOException 
    at org.apache.catalina.connector.OutputBuffer.realWriteBytes
        (OutputBuffer.java:366)
    at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:433)
    at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:348)
    at org.apache.catalina.connector.OutputBuffer.writeBytes
        (OutputBuffer.java:392)
    at org.apache.catalina.connector.OutputBuffer.write
        (OutputBuffer.java:381)
...
---------------------------------------------------------------------

Or maybe it is a server problem
---------------------------------------------------------------------
2006-12-01 12:03:50,945 DEBUG [AWT-EventQueue-0]
    httpclient.wire.content: << 
        "    The server is temporarily unable to service your[\n]"
2006-12-01 12:03:50,946 DEBUG [AWT-EventQueue-0]
    httpclient.wire.content: <<
        "    request due to maintenance downtime or capacity[\n]"
2006-12-01 12:03:50,946 DEBUG [AWT-EventQueue-0] 
    httpclient.wire.content: << 
        "    problems. Please try again later. [\n]"
---------------------------------------------------------------------


I add now some other log from the client,
thanks a lot for your help

bastian


http client log content and header 
(i am using http client release v3.0.1)
---------------------------------------------------------------------

2006-12-01 12:03:50,933 DEBUG [AWT-EventQueue-0] 
    httpclient.wire.content: << "[0xf6][0xaa][0x1b]`[0x1][0x0][0x0][0x0][0x0][0x0][0x0][0x17]tt[0x0] 9005fb74e13b001b1b33b14fc2401a07t[0x0]{\test_lab\backup\_10_19\test_lab\.metadata\.plugins\org.eclipse.core.resources\.history\e2\9005fb74e13b001b1b33b14fc2401a07sq[0x0]~[0x0][0x5][0x0][0x0][0x1][0xe]`eN[0xf0][0x1][0x0][0x0][0x0][0x0][0x0][0x0][0x6]$t[0x0] 10b5c990675f001b1155a5be31a04b17t[0x0]{\test_lab\backup\_10_19\test_lab\.metadata\.plugins\org.eclipse.core.resources\.history\e2\10b5c990675f001b1155a5be31a04b17sq[0x0]~[0x0][0x5][0x0][0x0][0x1][0xe][E[0xb1][0x80][0x0][0x0][0x0][0x0][0x0][0x0][0x0][0x0][0x0]t[0x0][0x2]5at[0x0][\test_lab\backup\_10_19\test_lab\.metadata\.plugins\org.eclipse."

2006-12-01 12:03:50,933 DEBUG [AWT-EventQueue-0]
    httpclient.wire.content: << "[\r]"
2006-12-01 12:03:50,933 DEBUG [AWT-EventQueue-0]
    httpclient.wire.content: << "[\n]"
2006-12-01 12:03:50,933 DEBUG [AWT-EventQueue-0]
    httpclient.wire.content: << "1"
2006-12-01 12:03:50,933 DEBUG [AWT-EventQueue-0] 
    httpclient.wire.content: << "e"
2006-12-01 12:03:50,933 DEBUG [AWT-EventQueue-0]
    httpclient.wire.content: << "[\r]"
2006-12-01 12:03:50,933 DEBUG [AWT-EventQueue-0] 
    httpclient.wire.content: << "[\n]"
2006-12-01 12:03:50,933 DEBUG [AWT-EventQueue-0]
     httpclient.wire.content: << "<?xml version="1.0" encoding=""
2006-12-01 12:03:50,934 DEBUG [AWT-EventQueue-0] 
    httpclient.wire.content: << "[\r]"
2006-12-01 12:03:50,935 DEBUG [AWT-EventQueue-0] 
    httpclient.wire.content: << "[\n]"
2006-12-01 12:03:50,935 DEBUG [AWT-EventQueue-0]
     httpclient.wire.content: << "a"
2006-12-01 12:03:50,935 DEBUG [AWT-EventQueue-0] 
    httpclient.wire.content: << "f"
2006-12-01 12:03:50,935 DEBUG [AWT-EventQueue-0] 
    httpclient.wire.content: << "[\r]"
2006-12-01 12:03:50,935 DEBUG [AWT-EventQueue-0]
     httpclient.wire.content: << "[\n]"
2006-12-01 12:03:50,935 DEBUG [AWT-EventQueue-0]
     httpclient.wire.content: << "ISO-8859-1"
2006-12-01 12:03:50,935 DEBUG [AWT-EventQueue-0]
     httpclient.wire.content: << ""?>[\n]"
2006-12-01 12:03:50,935 DEBUG [AWT-EventQueue-0]
     httpclient.wire.content: << "<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"[\n]"
2006-12-01 12:03:50,936 DEBUG [AWT-EventQueue-0] 
    httpclient.wire.content: << "  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">[\n]"
2006-12-01 12:03:50,936 DEBUG [AWT-EventQueue-0]
     httpclient.wire.content: << "<html xmlns="http://www.w3.org/1999/xhtml" lang=""
2006-12-01 12:03:50,936 DEBUG [AWT-EventQueue-0]
     httpclient.wire.content: << "[\r]"
2006-12-01 12:03:50,936 DEBUG [AWT-EventQueue-0]
     httpclient.wire.content: << "[\n]"
2006-12-01 12:03:50,936 DEBUG [AWT-EventQueue-0]
    httpclient.wire.content: << "e"
2006-12-01 12:03:50,936 DEBUG [AWT-EventQueue-0]
     httpclient.wire.content: << "[\r]"
2006-12-01 12:03:50,936 DEBUG [AWT-EventQueue-0] 
    httpclient.wire.content: << "[\n]"
2006-12-01 12:03:50,936 DEBUG [AWT-EventQueue-0]
     httpclient.wire.content: << "en"
2006-12-01 12:03:50,936 DEBUG [AWT-EventQueue-0] 
    httpclient.wire.content: << "" xml:lang=""
    
    HERE COMES THE SERVER ERROR PAGE
    AND THAN THE FIRST LOG FROM THIS
    MAIL
---------------------------------------------------------------------

> Hello Bastian,
> 
> > The same with a stream over the network failed.
> > Look like the first parts of the file will be
> > copied over but than the copy stops with the
> > following exception:
> > 
> > 
> > 2006-11-30 17:24:37,521 DEBUG [AWT-EventQueue-0]
> >    org.apache.commons.httpclient.HttpMethodBase:
> >        Resorting to protocol  version default close connection policy
> > 2006-11-30 17:24:37,521 DEBUG [AWT-EventQueue-0]
> >    org.apache.commons.httpclient.HttpMethodBase:
> >        Should NOT close connection, using HTTP/1.1
> > 2006-11-30 17:24:37,521 DEBUG [AWT-EventQueue-0]
> >      org.apache.commons.httpclient.HttpConnection:
> >          Releasing connection back to connection manager.
> > 
> > java.io.EOFException
> > 	at
> java.io.ObjectInputStream$BlockDataInputStream.peekByte(ObjectInputStream.java:2435)
> > 	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1245)
> > 	at
> java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1845)
> > 	at
> java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1769)
> > 	at
> java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
> 
> It's hard to tell whether this is a problem on the client or
> server side. You could please send a wire log for both header
> and content?
> http://jakarta.apache.org/commons/httpclient/logging.html
> 
> Have you tried receiving the data into a byte array instead
> of deserializing it immediately? Are there corresponding
> error messages on the server?
> 
> > I am using "application/octet-stream" is this ok?
> 
> I don't see anything wrong with this.
> 
> > Maybe something runs out of memory ?
> 
> That should generate a different kind of error.
> 
> cheers,
>   Roland
-- 
"Ein Herz für Kinder" - Ihre Spende hilft! Aktion: www.deutschlandsegelt.de
Unser Dankeschön: Ihr Name auf dem Segel der 1. deutschen America's Cup-Yacht!

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


Re: problems to deserialize a stream on the client

Posted by Roland Weber <ht...@dubioso.net>.
Hello Bastian,

> The same with a stream over the network failed.
> Look like the first parts of the file will be
> copied over but than the copy stops with the
> following exception:
> 
> 
> 2006-11-30 17:24:37,521 DEBUG [AWT-EventQueue-0]
>    org.apache.commons.httpclient.HttpMethodBase:
>        Resorting to protocol  version default close connection policy
> 2006-11-30 17:24:37,521 DEBUG [AWT-EventQueue-0]
>    org.apache.commons.httpclient.HttpMethodBase:
>        Should NOT close connection, using HTTP/1.1
> 2006-11-30 17:24:37,521 DEBUG [AWT-EventQueue-0]
>      org.apache.commons.httpclient.HttpConnection:
>          Releasing connection back to connection manager.
> 
> java.io.EOFException
> 	at java.io.ObjectInputStream$BlockDataInputStream.peekByte(ObjectInputStream.java:2435)
> 	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1245)
> 	at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1845)
> 	at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1769)
> 	at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)

It's hard to tell whether this is a problem on the client or
server side. You could please send a wire log for both header
and content?
http://jakarta.apache.org/commons/httpclient/logging.html

Have you tried receiving the data into a byte array instead
of deserializing it immediately? Are there corresponding
error messages on the server?

> I am using "application/octet-stream" is this ok?

I don't see anything wrong with this.

> Maybe something runs out of memory ?

That should generate a different kind of error.

cheers,
  Roland


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org