I know this is a Corba group, but I am hopeful that people
with Corba experience will have some RMI experience.
(at least some of the people) If you can help, I would appreciate
it.
I am having trouble starting my rmi application. It is a simple
program designed by our prof to help us learn how to use RMI.
I am getting no where with it. Everything is fine until I start
the client. At least I think everything is fine. I did use
stack trace on the exception to get feed back. I sense what it
is telling me that that paths I am using are not correct.
The exhbibits below give the steps I follow. The second exhibit
is the stack trace. The third is the client and server code. I left
out all the other stuff since it would just add bulk to this already
long request for help.
Thanks
John
----------- exhibit 1---------------------------
the steps I use for setting up and running the rmi application
S:\A2_498_rmi1A2_498_rmi1\RMI_DEMO_1>javac *.java
C:\A2_498_rmi1>rmic RMI_DEMO_1.Worker -d .
C:\A2_498_rmi1>start rmiregistry
C:\A2_498_rmi1>java -Djava.secturity.policy=total.policy RMI_DEMO_1.Server
C:\A2_498_rmi1>java -Djava.security.policy=total.policy RMI_DEMO_1.Client
localhost/w1 7
----------- exhibit 2---------------------------
The stack trace
java.rmi.NotBoundException: localhost/w1
at
sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknow
n Source)
at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at java.rmi.Naming.lookup(Unknown Source)
at RMI_DEMO_1.Client.main(Client.java:10)
----------- exhibit 3---------------------------
3a) the code in the client
...
public static void main(String[] args) {
try {
String name = args[0];
WorkerInterface w = (WorkerInterface)Naming.lookup(name);
int number = Integer.parseInt(args[1]);
Foo foo = new Foo();
System.out.println(w.call(foo, number));
} catch(Exception e) {e.printStackTrace(System.out);}
}
...
3b) the code in the server
...
public static void main(String[] args) {
System.setSecurityManager(new RMISecurityManager());
String name = "localhost/";
try {
Worker w1 = new Worker();
Naming.rebind(name + "w1", w1);
} catch(Exception e) {}
...
"john" <jkau...@home.com> wrote in message news:<GzGv7.33381$5r4.9...@news1.rdc1.mb.home.com>...
"john" <jkau...@home.com> wrote in message news:<GzGv7.33381$5r4.9...@news1.rdc1.mb.home.com>...
from the stacktrace it seems that your server isn't registered in
RMIRegistry under name you are looking for him therefore "NotBoundException"
try to use in server:
Naming.rebind("//localhost:1099/w1",w1);
Then client should bind to name "w1"
I hope it helps.
-Tomas