Win a copy of AWS Security this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger

Serialized object in a package.

Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I come across this weird problem in client server programming. The server application will use its writeObject method to output a customed object to client when a request comes in. This customed class implements Serialiable interface and it is put in the same directory as the server application. No packaging is applied in the code. At client side, the same customed class is put in the same directory as client application. When client reads in the object, the object is casted to the customed class. Data is read successfully from the customed class at client side.
Then i take a step further and put client application and the customed class in a package. The casting step fails. NoClassFoundError is caught. After some tweaking, i discover that if i use the same package name on server side, casting will work and everything. My concern is, should customed Serializable class must be packaged the same way at server and client side? Otherwise the casting will fail?

PS. Please help me to move this topic to the appropriate forum. I accidentally put it here. Thanks.
[ August 16, 2002: Message edited by: SoonAnn Lim ]
They gave me pumpkin ice cream. It was not pumpkin pie ice cream. Wiping my tongue on this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
    Bookmark Topic Watch Topic
  • New Topic