Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / June 2005

Tip: Looking for answers? Try searching our database.

Passing an object remotely

Thread view: 
Daniel - 19 Jun 2005 00:23 GMT
Hello all,

I have this object

private Patient maakDezePatient() throws java.rmi.RemoteException
  {
     return new Patient(Integer.parseInt(sleutelVeld.getText()),
                                       Integer.parseInt(sofiNummerVeld.getText()),
verzekeringsMaVeld.getText(),
                                       Integer.parseInt(polisNummerVeld.getText()),
naamVeld.getText(),
                                       adresVeld.getText(),
postcodeVeld.getText(), woonplaatsVeld.getText(),
                                       gebDatumVeld.getText());
  }

Im still a beginner, This object is on the client pc, The Patient Class is
on the server. I have a PatientInterface. I know my classes are
serializable. It it have to be when i want to pass whole object through the
line. I cannot find any examples on how to define this in my Interface.

And can someone please tell me what does this object actually? Is it that
the first line starting with private calls a reference to the Patient class?
and then returns the constands given by the Patient class? Im really lost,
becouse i understand how to use the Interface to define methods, where the
server class implents the Interface. But in this case i dont know how to
change this merhod to do so becouse it always gives me an error that the
Class isnt available on the client, its true, so thats why i think i the
best way is to call a remote object with serializability.

Thanks a lot for all the help.

Danny
Steve Horsley - 19 Jun 2005 16:17 GMT
> Hello all,
>
[quoted text clipped - 29 lines]
>
> Danny

Serialization can transfer an object betwnn VMs (using
ObjectInputStream and ObjectOutputStream) but the class of this
object MUST be known at both ends. This means that the file
Patient.class must be readable by both the sender and recipient.

This is because serialization basically sends "Here is an object
of type Patient, and these are all the field values...". Unless
the recipient can then load the Patient class with its
classloader, it cannot reconstitute a Patient object. This is
very similar to a VM executing code "p = new Patient" when it
cannot find a Patient class file.

HTH
Steve


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.