• Post Reply Bookmark Topic Watch Topic
  • New Topic

Serialized object in a package.  RSS feed

SoonAnn Lim
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 ]
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!