Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

RMISerializtionQuestion  RSS feed

 
rafeeque mohd abdul
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am writing distributing web application using RMI.I am send Serialzied class object back to client.Using RMI.
My Question is?
I have to copy my Serialzied class in both JVM means in Clent and in Servler.
Is it Correct?
If it is correct then tell my why we are copying Serialzied class in both JVM.

Thanking you
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not entirely sure this is what you're asking... but the serialized form of an object is just data - Strings, numbers, etc. - there's no real way to know how to put that data back together into an object without some knowledge of what that data means. If you have a file full of numbers - are those numbers last months sales figures, a 3D model of a dinosaur, an encrpyted message, or the pixel data for an image? In the Java world, the thing that figures out the context of data is the class - via the readObject and writeObject methods. Some classes can just inherit the default implementations of these, and be fine - others may need to implement custom versions for various reasons. RMI can use built in Java object serialization to send serialized objects across the network, but, as you have noticed - you still need the class. The easiest way to do this for classes that aren't going to change much is to just provide the class file to the client with the client code. A more advanced way to handle class distribution is by dynamically downloading classes as class files as they are needed - you can get more information about how to do this in the Sun article 'Dynamic code downloading using RMI.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!