Partially deserialized objects?

Discussion in 'Java' started by Eric Czarny, Nov 30, 2007.

  1. Eric Czarny

    Eric Czarny Guest

    I am trying to send a serialized object from a JSP to another servlet
    through HTTP, but I keep running into an invalid stream header
    exception. My theory is that the servlet is (for some reason or
    another) not reading the whole serialized object. I have tried placing
    logging statements at different stages of the serialized object. If I
    specify the Content-Length of the serialized object more logging
    statements show up, but I still run into the invalid stream header
    problem. Am I missing something critical? Has anybody else seen this
    (or a similar) problem before?

    Cheers,
    Eric Czarny
    Eric Czarny, Nov 30, 2007
    #1
    1. Advertising

  2. Eric Czarny

    Esmond Pitt Guest

    Eric Czarny wrote:

    > Has anybody else seen this
    > (or a similar) problem before?


    This is usually caused by different lifetimes of the ObjectOutputStream
    and ObjectInputStream on one side or the other when sending multiple
    objects. You need to use one of each for the life of the connection, and
    make sure you flush & close the OOS, not the stream it encloses.
    Esmond Pitt, Dec 1, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alex Nitulescu
    Replies:
    5
    Views:
    455
    Alex Nitulescu
    Feb 21, 2005
  2. news.microsoft.com
    Replies:
    0
    Views:
    417
    news.microsoft.com
    Apr 12, 2006
  3. Francisco Garcia
    Replies:
    2
    Views:
    456
    Fran Garcia
    Apr 13, 2006
  4. bintom
    Replies:
    3
    Views:
    335
    Brian
    Jun 6, 2010
  5. Replies:
    0
    Views:
    139
Loading...

Share This Page