Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

RMI Vector/ArrayList Serialization problem

Dave Winters
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

Im having a problem at the moment trying send a Vector which contains a serialized class objects from my server program to my client. Firstly i retrieve the contents of a file, store them into the serialized class "Reservation", i then add each new Reervation object to a Vector. I the wish to send this Vector to the client so it can print out the list of "Reservation Objects" from my Vector class. It prints out the value null. There seems to be a problem, with adding serialized objects to the Vector class. I thought The Vector class was serializable. There is no problem with the Serialized Reservation class. I can send it to/from the client/server no problem. Any help with this problem would be greatly appreciated.




[Andrew: Put code between [code] and [/code] UBB tags]
[ April 22, 2005: Message edited by: Andrew Monkhouse ]
Andrew Monkhouse
author and jackaroo
Marshal Commander
Posts: 12056
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Dave,

Welcome to JavaRanch and this forum.

You will notice that I have edited your post to put the code between

Then printing them out at the far end:

When I run this I get the following output:

Note that I am using JDK 1.5 which does some nicer things with displaying contents of Collections, and also allows me to use Generics in my SocketClient.

So starting with that code as a basis, you should be able to see that you can send a Vector containing Serialized Objects through sockets. Perhaps you can create some dummy data to fit into your Reservation instance, and plug it into the code above to see if this is working? Then put in the real data into the Reservation instance and see if it still works, and so on, until you work out where things start to break.

Regards, Andrew
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!