Hi All, I had my assignment working with RMI, when I decided I did not like the class name of my remote server and refactored it to a new name. Now my client can no longer bind to the RMI server! I get this exception:
I register the server in RMI as follows:
And then I access the server from the client as such:
FBNDataBaseRemoteImpl is defined as follows:
Am I missing something, or perhaps mistyped something? Like I said, everything was fine before I changed the class name. Help! Thanks! --Dave.
Can you try to create the _Stubs again and give it a try?
posted 17 years ago
I have tried recompiling all the code, including the stub. Also, I even rebooted the machine on the off chance some rouge process was hanging around. But alas, it still fails with a class cast exception. I stepped through the code with the debugger, and the Naming.lookup does indeed return a valid FBNDataBaseRemoteImpl_Stub object. The problem occurs when I cast it to a FBNDataBaseRemoteImpl object. The FBNDataBaseRemoteImpl object extends UnicastRemoteObject and implements Remote. Is there something wrong with my FBNDataBaseRemoteImpl declaration? Thanks! --Dave.
posted 17 years ago
Fixed it!!! It was a JDK/JRE version problem. I had an older JRE sitting in the system path, and somehow my vm must have been loading some older files. I have no idea how my RMI implementation could have ever worked, I did not change the PATH or CLASSPATH. Perhaps when I modified the code, I inadventantly caused a diffent code path to be executed within the underlying RMI impl. Anyway, there goes 4 hours of my life! On to the next bug!
Nah, it didn't help for me. I have Oracle's JRE in my path, and I removed it, even at the expense of not being able to run some Oracle tools. And the deleted all the class files and recompiled and re-rmic'd but still no avail. Mark
Mark, What exception are you getting? Is it a class cast? Post some snipits of code and I will compare it to mine as well as trying it on my machine. I found the RMI incredibly easy to set up and get working THE FIRST TIME. Once it broke, it is very hard to debug! If you want to, mail me the relevant code and I will test it on my machine. Good Luck! --Dave.