• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Serialized object in a package.

 
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
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?
Regards,

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 ]
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic