J
John English
I'm trying to write an application which communicates with a remote
server. Normally an applet is loaded from the server system which
handles all the communication, but in this case I need to use an
application rather than an applet.
The communication uses a class called Message, and Message objects
are sent back and forth using ObjectInputStream and ObjectOutputStream.
My application has a class MessageWrapper which uses a URLClassLoader
to load the Message class from the server and find its constructor and
relevant methods. It then calls the constructor:
private Object obj;
...
obj = cons.newInstance(new Object[] {});
All this works fine.
The problem comes when I try to get the reply message. I do this:
createMessage (in.readObject());
where createMessage creates a MessageWrapper and sets the internal
object "obj" to its parameter. It never gets into createMessage() --
it dies with a ClassNotFound exception, presumably because the
object is one belonging to a class that doesn't exist on my machine.
Can anyone explain how I can get around this?
-----------------------------------------------------------------
John English | mailto:[email protected]
Senior Lecturer | http://www.it.bton.ac.uk/staff/je
Dept. of Computing | ** NON-PROFIT CD FOR CS STUDENTS **
University of Brighton | -- see http://burks.bton.ac.uk
-----------------------------------------------------------------
server. Normally an applet is loaded from the server system which
handles all the communication, but in this case I need to use an
application rather than an applet.
The communication uses a class called Message, and Message objects
are sent back and forth using ObjectInputStream and ObjectOutputStream.
My application has a class MessageWrapper which uses a URLClassLoader
to load the Message class from the server and find its constructor and
relevant methods. It then calls the constructor:
private Object obj;
...
obj = cons.newInstance(new Object[] {});
All this works fine.
The problem comes when I try to get the reply message. I do this:
createMessage (in.readObject());
where createMessage creates a MessageWrapper and sets the internal
object "obj" to its parameter. It never gets into createMessage() --
it dies with a ClassNotFound exception, presumably because the
object is one belonging to a class that doesn't exist on my machine.
Can anyone explain how I can get around this?
-----------------------------------------------------------------
John English | mailto:[email protected]
Senior Lecturer | http://www.it.bton.ac.uk/staff/je
Dept. of Computing | ** NON-PROFIT CD FOR CS STUDENTS **
University of Brighton | -- see http://burks.bton.ac.uk
-----------------------------------------------------------------