Hi,
I'm trying to teach myself RMI from Sun's tutorial, I'm using Windows 98 (without a network or webserver , in case that makes a difference) and am running into problems with getting the Calculator example to work, first I'll list a couple of the problems that I've overcome, which may be of help to others:-
I found that I needed to set CLASSPATH in autoexec.bat inorder to get the files to compile, I've currently got the following line in my autoexec.bat
SET CLASSPATH=.;C:\jdk1.3.0_02\jre\classes;C:\javatutorials\rmi\example;C:\java\rmi;
(Sorry if these seems trivial - but it took me a little while to figure out)
Next I found that I was getting the following exception after starting the client :-
C:\javatutorials\rmi\example>
java CalculatorClient
client starting
RemoteException
java.rmi.UnknownHostException: Unknown host: remotehost; nested exception is:
java.net.UnknownHostException: remotehost
After searching through the RMI group I found that someone else had had this problem and that remotehost should be replaced by localhost. I'm suprised that the Sun Tutorial has a typing error like this, if thats what it is, surely they must have been alerted to the error by now. Perhaps it isn't an error, but using localhost seemed to improve matters - it now manages to create a Calculator object using Naming.lookup, but I now get the following NoRouteToHostException :-
C:\javatutorials\rmi\example>java CalculatorClient
client starting
client about to call sub
RemoteException
java.rmi.ConnectIOException: Exception creating connection to: 4.0.0.3; nested e
xception is:
java.net.NoRouteToHostException: Host unreachable: connect
I've copied the code (4 java files) below, its pretty much cut and pasted from Sun's Tutorial, with a few System.out.println's so I know where its got to.
I've tried using a permit file as suggested in the "Just Java 2" book, but that doesn't make any difference, and i've got a feeling that that isn't the problem. I did have a firewall (Tiny's personal firewall) running, but I've disabled it, so it isn't due to that. I've also tried running with an open internet connection, with the same results, except that it takes longer to not work (don't know why that should make any difference, but I read somewhere that it might). I'm going to carry on experimenting with different approaches, but I'm really clutching at straws, and have a feeling it could be something really simple that I just don't know about (I know next to nothing about TCP/IP , networking etc.) - any help would be appreciated , in the meantime if I find out a solution I'll post a follow up here
thanks Mike
[ March 31, 2002: Message edited by: Mikey Warren ]
[ March 31, 2002: Message edited by: Mikey Warren ]