• Post Reply Bookmark Topic Watch Topic
  • New Topic

Urgent help required!  RSS feed

 
reehan ishaque
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
im serializing an object through socket over LAN. On receicing end when i receive the serialized object an error message is raised "can not resolve symbol" i.e java compiler couldn't find that object's class. Is it necessary to put that class file on remote machine even in case of serialization??? i will appreciate if u reply as soon as possible.
thanks
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by reehan ishaque:
Is it necessary to put that class file on remote machine even in case of serialization???
Yes.
- Peter
 
reehan ishaque
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for ur reply Peter.
Is there any way i could prevent myself from putting .class file on remote machine's class path manually. any way to include .class file automatically and dynamically from the network.
thanx
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, you can download classes and RMI stubs, usually from an HTTP server --- but that introduces a lot of extra complexity. Believe me, you don't want to go there. It'll double the time it takes to do the assignment and probably halve your score
- Peter
 
David Weitzman
Ranch Hand
Posts: 1365
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could just send a copy of the bytecode and load it with your own classloader before you send the serialized object. A long time ago I was looking at some mobile agent stuff, and I remember muCode did something like this.
 
David Weitzman
Ranch Hand
Posts: 1365
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually muCode seems to use what it calls, Remote Dynamic Linking. A custom ClassLoader that requests bytecode and a class-sending server that sends it can be used to allow downloading remote classes on an as-needed basis.
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Peter den Haan:
[...] It'll double the time it takes to do the assignment and probably halve your score
Oh, help, I don't know what I was thinking -- but one thing's clear, I'm spending too much time in the developer certification forum!
It's not too difficult to define your own ClassLoader. The javadoc for ClassLoader gives the skeleton for a NetworkClassLoader that can load classes over the network.
- Peter
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!