Java. Io. invalidclassexception: local class incompatible: stream classdes

Source: Internet
Author: User
Tags bit set






Re: Ava. Io. invalidclassexception: local class incompatible: stream classdes
Feb 29,200 8 AM (Reply 15 of 19)

  My Java version is the 1.5.0 _ 14 and the value-3126998878902358585l comes from a solution that I read in a forum. The class that I'm trying to use is:
Import java. util. date;

Public class dateextendido extends Date {

Static final long serialversionuid =-3126998878902358585l;

Public date = NULL;

Public dateextendido (){
Super ();
}

Public dateextendido (date d ){
Super ();
Date = D;
}
}

I'm using it in this lines:

Try {
Dateextendido iniciodesdeex = new dateextendido (iniciodesde );
Out. writeobject (iniciodesdeex );
Dateextendido iniciohastaex = new dateextendido (iniciohasta );
Out. writeobject (iniciohastaex );
}
Catch (exception e ){
E. printstacktrace (system. Out );
}

...

Dateextendido iniciodesdeex = NULL;
Try {
Iniciodesdeex = (dateextendido) in. readobject ();
Iniciodesde = iniciodesdeex. date;

Dateextendido iniciohastaex = (dateextendido) in. readobject ();
Iniciohasta = iniciohastaex. date;
} Catch (exception e ){
E. printstacktrace (system. Out );
}

And the error:

Java. Io. invalidclassexception: Java. util. date; local class incompatible: stream classdesc serialversionuid = 7523895402267505689, local class serialversionuid = 7523967970034938905
At java. Io. objectstreamclass. initnonproxy (unknown source)
At java. Io. objectinputstream. readnonproxydesc (unknown source)
At java. Io. objectinputstream. readclassdesc (unknown source)
At java. Io. objectinputstream. readnonproxydesc (unknown source)
At java. Io. objectinputstream. readclassdesc (unknown source)
At java. Io. objectinputstream. readordinaryobject (unknown source)
At java. Io. objectinputstream. readobject0 (unknown source)
At java. Io. objectinputstream. readobject (unknown source)
At dumbo7.user. filtrousuario. readobject (filtrousuario. Java: 348)
At dumbo7.user. filtrousuario. importfiltro (filtrousuario. Java: 436)
At dumbo7.user. dumbouser. setpersonaldata (dumbouser. Java: 250)
At dumbo7.user. dumbouser. <init> (dumbouser. Java: 69)
At dumbo7.inicio. gestorinicio. logindumbo (gestorinicio. Java: 81)
At sun. Reflect. nativemethodaccessorimpl. invoke0 (native method)
At sun. Reflect. nativemethodaccessorimpl. Invoke (unknown source)
At sun. Reflect. delegatingmethodaccessorimpl. Invoke (unknown source)
At java. Lang. Reflect. method. Invoke (unknown source)
At atica. frameweb. Manager. managermodule. domethod (managermodule. Java: 611)
At atica. frameweb. Manager. managermodule. doobjectdbmethod (managermodule. Java: 371)
At atica. frameweb. Manager. managermodule. doobject (managermodule. Java: 261)
At atica. frameweb. Manager. managermodule. doactions (managermodule. Java: 201)
At atica. frameweb. Manager. httpservletmanager. Service (httpservletmanager. Java: 122)
At javax. servlet. http. httpservlet. Service (httpservlet. Java: 803)
At org. Apache. Catalina. servlets. invokerservlet. serverequest (invokerservlet. Java: 420)
At org. Apache. Catalina. servlets. invokerservlet. doget (invokerservlet. Java: 134)
At javax. servlet. http. httpservlet. Service (httpservlet. Java: 690)
At javax. servlet. http. httpservlet. Service (httpservlet. Java: 803)
At org. Apache. Catalina. Core. applicationfilterchain. internaldofilter (applicationfilterchain. Java: 269)
At org. Apache. Catalina. Core. applicationfilterchain. dofilter (applicationfilterchain. Java: 188)
At org. Apache. Catalina. Core. standardwrappervalve. Invoke (standardwrappervalve. Java: 213)
At org. Apache. Catalina. Core. standardcontextvalve. Invoke (standardcontextvalve. Java: 174)
At org. Apache. Catalina. Core. standardhostvalve. Invoke (standardhostvalve. Java: 127)
At org. Apache. Catalina. Valves. errorreportvalve. Invoke (errorreportvalve. Java: 117)
At org. Apache. Catalina. Core. standardenginevalve. Invoke (standardenginevalve. Java: 108)
At org. Apache. Catalina. connector. coyoteadapter. Service (coyoteadapter. Java: 151)
At org. Apache. Coyote. http11.http11processor. Process (http11processor. Java: 874)
At org. Apache. Coyote. http11.http11baseprotocol $ http11connectionhandler. processconnection (http11baseprotocol. Java: 665)
At org.apache.tomcat.util.net. pooltcpendpoint. processsocket (pooltcpendpoint. Java: 528)
At org.apache.tomcat.util.net. leaderfollowerworkerthread. Runit (leaderfollowerworkerthread. Java: 81)
At org. Apache. tomcat. util. threads. threadpool $ controlrunnable. Run (threadpool. Java: 689)
At java. Lang. thread. Run (unknown source)

 
Ibancg
Posts: 1
Registered: 3/4/08
Re: Ava. Io. invalidclassexception: local class incompatible: stream classdes
Mar 4, 2008 am (Reply 16 of 19)

  Hi, I was having this error.

Take a look at the hex representation of both serial UIDs:

7523895402267505689: 0x686a3f014b597400
7523967970034938905: 0x686a81014b597400

The 0x3f was changed by a 0x81.

In my case this behaviour was caused (only in MS windows) by a string proccessing of the serialized object stream before unmarshall the object. A proccessing like that:

Byte [] processedserializedobjectbytearray = serializedobjectbytearray. tostring (). Replace (...,...). getbytes ();

I fixed the problem with binary replace instead of using the string API, wich causes the replacement of 0x3f characters into 0x81 (only in MS for Windows ).
Are you doing a similar string proccessing?

 
Ejp
Posts: 15,588
Registered: 5/11/97
Re: Ava. Io. invalidclassexception: local class incompatible: stream classdes
Mar 4, 2008 PM (Reply 17 of 19)

  Also @ op I can't see what value the dateextendido class is adding...  
Relicary
Posts: 4
Registered: 2/25/08
Re: Ava. Io. invalidclassexception: local class incompatible: stream classdes
Mar 5, 2008 am (Reply 18 of 19)

  Hi,

I'm tried another way. cos the java. util. date don't works anyway, I'm saving it as a string using dateformat. the string type don't need the serialversionuid.

 
Ejp
Posts: 15,588
Registered: 5/11/97
Re: Ava. Io. invalidclassexception: local class incompatible: stream classdes
Mar 5, 2008 PM (Reply 19 of 19)

  See reply #16. the 0x81 is the only byte with the high bit set and it is the only byte which is being upted. this clearly indicates that you are corrupting the stream somewhere, possibly by using a reader or writer, or converting it to and from a string. if you don't fix that problem it will come back and bite you somewhere else.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.