![]() |
InvalidClassException question
According to the docs, this is exception is thrown:
"when the Serialization runtime detects one of the following problems with a Class. * The serial version of the class does not match that of the class descriptor read from the stream * The class contains unknown datatypes * The class does not have an accessible no-arg constructor " Can someone explain to me what "The class contains unknown datatypes" means? I'm getting this exception, and can't figure out why. Both sides (local and remote) use the same class, in the same jar, and run in the same JVM (which rules out the 1st reason). The class does have a public no-arg constructor (which rules out the 3rd reason), and I've tried encoding the serialVersionUID directly in the class just to make sure. Aidan |
Re: InvalidClassException question
Aidan wrote:
> According to the docs, this is exception is thrown: > > "when the Serialization runtime detects one of the following problems > with a Class. > > * The serial version of the class does not match that of the class > descriptor read from the stream > * The class contains unknown datatypes > * The class does not have an accessible no-arg constructor " > > > Can someone explain to me what "The class contains unknown datatypes" > means? > > I'm getting this exception, and can't figure out why. Both sides (local > and remote) use the same class, in the same jar, and run in the same JVM > (which rules out the 1st reason). The class does have a public no-arg > constructor (which rules out the 3rd reason), and I've tried encoding > the serialVersionUID directly in the class just to make sure. > > > > Aidan Problem two means that if any of a classes' members are non-primitive, non-serializable objects, then you can't serialize an instance of that class. Derek |
Re: InvalidClassException question
Derek Chen-Becker wrote:
> Aidan wrote: > >> According to the docs, this is exception is thrown: >> >> "when the Serialization runtime detects one of the following problems >> with a Class. >> >> * The serial version of the class does not match that of the class >> descriptor read from the stream >> * The class contains unknown datatypes >> * The class does not have an accessible no-arg constructor " >> >> >> Can someone explain to me what "The class contains unknown datatypes" >> means? >> >> I'm getting this exception, and can't figure out why. Both sides >> (local and remote) use the same class, in the same jar, and run in the >> same JVM (which rules out the 1st reason). The class does have a >> public no-arg constructor (which rules out the 3rd reason), and I've >> tried encoding the serialVersionUID directly in the class just to make >> sure. >> >> >> >> Aidan > > > Problem two means that if any of a classes' members are non-primitive, > non-serializable objects, then you can't serialize an instance of that > class. > > Derek Thanks Derek - it actually turned out to be an instance of the 1st problem, since some code had been changed to serialize object instances to a file. doh! |
Re: InvalidClassException question
On Fri, 04 Jun 2004 14:16:39 GMT, Aidan <aidan@nowhere.com> wrote or
quoted : >Can someone explain to me what "The class contains unknown datatypes" means? see http://mindprod.com/jgloss/errormess...CLASSEXCEPTION That sounded like one of Sun's better explanations. Mine won't be that much more elucidating, but at least it is longer. -- Canadian Mind Products, Roedy Green. Coaching, problem solving, economical contract programming. See http://mindprod.com/jgloss/jgloss.html for The Java Glossary. |
Re: InvalidClassException question
On Fri, 04 Jun 2004 14:16:39 GMT, Aidan <aidan@nowhere.com> wrote or
quoted : > >I'm getting this exception, and can't figure out why. Both sides (local >and remote) use the same class, in the same jar, and run in the same JVM >(which rules out the 1st reason). The class does have a public no-arg >constructor (which rules out the 3rd reason), and I've tried encoding >the serialVersionUID directly in the class just to make sure. Are you getting the problem on write or read? -- Canadian Mind Products, Roedy Green. Coaching, problem solving, economical contract programming. See http://mindprod.com/jgloss/jgloss.html for The Java Glossary. |
Re: InvalidClassException question
On Fri, 04 Jun 2004 14:16:39 GMT, Aidan <aidan@nowhere.com> wrote or
quoted : >I'm getting this exception, and can't figure out why. Both sides (local >and remote) use the same class, in the same jar, and run in the same JVM >(which rules out the 1st reason). The class does have a public no-arg >constructor (which rules out the 3rd reason), and I've tried encoding >the serialVersionUID directly in the class just to make sure. have you freshly written these objects with your latest class definition? Have you utterly proved to yourself you are using identical code on both ends? You might write an Integer( version ) at the head of both streams just to be sure. -- Canadian Mind Products, Roedy Green. Coaching, problem solving, economical contract programming. See http://mindprod.com/jgloss/jgloss.html for The Java Glossary. |
Re: InvalidClassException question
Roedy Green wrote:
> > have you freshly written these objects with your latest class > definition? That was exactly the problem Roedy. |
| All times are GMT. The time now is 07:29 AM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.