Trouble with InvalidClassException when running application in Eclipse.

Discussion in 'Java' started by aaronfude@gmail.com, Jun 18, 2007.

  1. Guest

    Hi,

    My actuall situation is to convoluted to describe fully, but basically
    my servlet serializes and my application, which I run out of Eclipse,
    deserializes and I get

    mypackage.MyClass$1; local class incompatible: stream classdesc
    serialVersionUID = -6759369633728135399, local class serialVersionUID
    = 8248309381925280497

    This does not happen when I compile and run the classes outside of
    Eclipse.

    Any ideas on how fix this?
     
    , Jun 18, 2007
    #1
    1. Advertisements

  2. On Jun 17, 10:55 pm, wrote:
    > Hi,
    >
    > My actuall situation is to convoluted to describe fully, but basically
    > my servlet serializes and my application, which I run out of Eclipse,
    > deserializes and I get
    >
    > mypackage.MyClass$1; local class incompatible: stream classdesc
    > serialVersionUID = -6759369633728135399, local class serialVersionUID
    > = 8248309381925280497
    >
    > This does not happen when I compile and run the classes outside of
    > Eclipse.
    >
    > Any ideas on how fix this?


    You can override the serialVersionUID in your data object that you're
    serializing.

    Something like :

    private static final long serialVersionUID = 1L;

    However, you will have to change this ID or figure out compatiblity
    (via externalization instead of serialization?) whenever you add/
    remove state variables.

    Personally, I prefer externalization over serialization due to that
    fact that I have larger control (write to XML/CSV/compress/encrypt..)
    and I can handle versions of data objects in a clear fashion.

    -cheers,
    Manish
     
    Manish Pandit, Jun 18, 2007
    #2
    1. Advertisements

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. Bob Rock
    Replies:
    2
    Views:
    486
    Bob Rock
    Jun 14, 2004
  2. Mario Rosario

    Help - java.io.InvalidClassException

    Mario Rosario, Sep 19, 2003, in forum: Java
    Replies:
    6
    Views:
    22,239
    SteveE
    Sep 24, 2003
  3. Dave Rudolf
    Replies:
    3
    Views:
    4,650
    Sudsy
    Dec 20, 2003
  4. Aidan
    Replies:
    6
    Views:
    1,283
    Aidan
    Jun 4, 2004
  5. Nomak
    Replies:
    11
    Views:
    2,112
    Arnaud Berger
    Apr 18, 2005
  6. Replies:
    1
    Views:
    492
    Richard Brown
    May 23, 2006
  7. Raga

    InvalidClassException!

    Raga, Sep 26, 2006, in forum: Java
    Replies:
    10
    Views:
    4,741
    shweta.naik
    Aug 22, 2007
  8. Ron Vecchi
    Replies:
    0
    Views:
    255
    Ron Vecchi
    Aug 4, 2003
Loading...