Hi, guys
I encountered a problem: I cant bind my remote object to the rmiregistry service.
My working steps is as follows:
1) In the current directory (let's suppose it is D:\\server\) I created the remote object class -
DataImpl(certainly there's also the remote interface), in its main method, I wrote the code:
try
{
DataImpl di = new DataImpl();
Naming.rebind("test", di);
}
catch(Exception e)
{
System.out.println(e);
}
2) run the javac to create the .class files: javac *.java.
I found all the .class files are correctly created in the directory.
3) rum the rmic to create the stub class: rmic -v1.2 DataImpl.
I found the expected DataImpl_Stub.class is also correctly created in the directory.
4) from
c:\\ run the rmiregistry: rmiregistry
I made the directories different intentionally for i assumed they are not necessarily to be the same.
5) as I hava no HTTP Server installed in my pc, i intended to use file protocol for the
java.rmi.server.codebase property.
I made the "D:\\server\" directory sharable and it's sharing name is "server"
6) from D:\\server\ (where the DataImpl and its stub class reside) run the
java:
java DataImpl -Djava.rmi.server.codebase="file://James/server/"
("James" is the name of my pc)
It reported RemoteException and its nested Exception is UnmarsalExcepton and its nested Exception is
ClassNotFoundException: DataImpl_Stub.
Anyone has some clues? if I use file protocol, do i also need to use sth like a File Server to service the incoming request? I assumed my Win98 has the built-in service and could do it automatically, for i could see the contents of the directory from other pc using "file://james/server/".
In the step 4), if i started the rmiregistry from "D:\\server\", it works even without the codebase property, how strange!
How rmiregistry get to know the location of the registried objects? I think the codebase propery specifies not only the location of the remote object but also the protocol the clients could require the stub, if no protocol given, In which way clients could download the stub class? the problem really drives me nuts!
Any reponse and analyse is greatly appreciated
Thanks in advance
- James Du
[ March 09, 2002: Message edited by: James Du ]