Works on windows, not on linux..

I have been developing an RMI app on Windows and it worked fine.

The time came to move it to Linux (fedora) and the server failed to register with rmiregistry. I think it is a codebase issue.

I have reduced it to a very simple form to get rid of any complications and it still fails. I have a Remote interface TestInterface, an implementation TestInterfaceImpl and a server as follows:

package mytest;

public class TestServer {

public static void main(String[] args) {

TestInterface r=new TestInterfaceImpl();

Naming.rebind("//localhost/hello",r);

}

}

When run with

-Djava.rmi.codebase=file:///usr/test/

(which is where the class files are) this gets a ClassNotFound thrown by the rmiregistry when trying to find mytest.TestInterface.

However on windows an equivalent construction with codebase=file:///c:/test/ works fine.

Currently I feel I am basing my head against a brick wall...

(p.s. registry, client and server are all running on same machine)

Thanks for any help.

[1077 byte] By [russelb3a] at [2007-11-26 16:34:15]
# 1
Be careful of package structures. If your classes has "mytest" package declaration your codebase directive must point at the root folder of the structure that contains mytest folder which has .class inside of it.Perhaps in windows you have a CLASSPATH enviroment variable set?
topfoxya at 2007-7-8 22:58:58 > top of Java-index,Core,Core APIs...
# 2

Thanks for those ideas. I have checked and double checked the package structures, and I have also made sure to unset CLASSPATH (not that it was ever set) before running rmiregistry on both Windows and Linux. Still nothing!

The only things I can think of is it is something in the format of the codebase url (but it looks fine, doesn't it?), or that rmiregistry somehow cannot open the class files (filesystem permissions or something like that acting).

This is jdk 1.5.0_03 by the way.

Also I have tried all this both with and without a security manager set to java.security.AllPermission with the same results.

I am starting to think there must be something wrong with the linux installation, I will try it on a completely independent other machine.

russelb3a at 2007-7-8 22:58:58 > top of Java-index,Core,Core APIs...
# 3
Well, infact its seems the right property to set is -Djava.rmi.server.codebase...So the right directive would be:-Djava.rmi.server.codebase=file:///usr/test/
topfoxya at 2007-7-8 22:58:58 > top of Java-index,Core,Core APIs...
# 4
As, yes, thanks. Unfortunately that was just a typo by me writing into the forum, the actual command used is correct..
russelb3a at 2007-7-8 22:58:58 > top of Java-index,Core,Core APIs...
# 5
Solved!I had a symbolic link pointing to the wrong version of rmiregistry on the linux machine.Thanks for everyone's replies.
russelb3a at 2007-7-8 22:58:58 > top of Java-index,Core,Core APIs...
# 6
Check to see if you have the useless GNU Java installed. If so, delete it and save yourself a lot of future problems.
ejpa at 2007-7-8 22:58:58 > top of Java-index,Core,Core APIs...