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. Advertising

  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. 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. Mario Rosario

    Help - java.io.InvalidClassException

    Mario Rosario, Sep 19, 2003, in forum: Java
    Replies:
    6
    Views:
    21,271
    SteveE
    Sep 24, 2003
  2. Dave Rudolf
    Replies:
    3
    Views:
    4,469
    Sudsy
    Dec 20, 2003
  3. Aidan
    Replies:
    6
    Views:
    1,073
    Aidan
    Jun 4, 2004
  4. Nomak
    Replies:
    11
    Views:
    1,889
    Arnaud Berger
    Apr 18, 2005
  5. Raga

    InvalidClassException!

    Raga, Sep 26, 2006, in forum: Java
    Replies:
    10
    Views:
    4,429
    shweta.naik
    Aug 22, 2007
Loading...

Share This Page