I am having a strange problem using Java RMI. I am building a chat program in Java 5 Tiger, using the RMI framework and Java seems to be caching one of my interface implementations, as when I change a line of code, it still seems to use a previous one.
An example is:
the first line of code i had, which i was using to test that the server side was sending RMI messages back to the client side, which worked and printed the message out as required.
I am thinking that perhaps i need to clear the java cache, or rmiregistry or something but I do not know how to do this.
Please help, this is very frustrating!
11-25-2005, 06:14 AM
Did you try stopping and starting the RMI registry?
Or perhaps generate a new proxy / stub?
11-25-2005, 06:50 AM
Yes, I have indeed tried to restart the rmiregistry.
I am affraid I do not know how to generate a new proxy / stub. Could you elaborate please?
11-25-2005, 09:16 AM
Well, to get the RMI to work in the first place, you have to do some things with your code and a external program, which generates 2 new class files, the proxy and the stub. (I'm not sure about the name of the program since I don't have my books here...)
It might be that you accidentally deleted you class file directory, which holds those files.
11-25-2005, 03:14 PM
I do not that this is the problem because RMI is working because I am successfuly connecting to the server and it is indeed connecting and returning data to the client.
Unfortunately, the data is being sent to the command window rather that the gui, as though it is reading the System.out.println instead of the txtPane.setText() line of code.
I am utterly confused as the program continues to print out this line of code that does not exist!
Any more suggestions would be most welcome.
11-28-2005, 04:39 AM
Did you delete you class files before recompiling?
because I discovered that sometimes the compiler doesn't overwrite classfiles already there, even though they have changed.