I am running in to some problems. Here is the setup. I have an HP Unix System running rmiregistry with a bound Controller called /OrderController. The client is a Windows NT4 system. I run the HelloClient program using the following command line: java -Djava.security.policy=Registry.policy HelloClient This works only when the 'Stub' class is in the same directory as the HelloClient class. If I put the 'Stub' class in a different directory/package and try to point it by using the classpath AND/OR using the java.rmi.server.codebase it doesn't work. Ideally, I would like to get the 'Stub' class from the HP Unix System using ftp but have been unsuccessful in getting this to happen. I would really like some suggestions.
Fredrik Safstrom
Greenhorn
Joined: May 15, 2001
Posts: 20
posted
0
Terry, What's wrong with distributing the stub it with your RMI client? Another way would be to package everything in a JAR file and run the client from the JAR file, in this case you only need to distribute one file... I don't know how to get the stub from an FTP server, but you could definitly put it on a web-server and load it from there... You can then specify the web-server in your codebase and it should work fine... /Bamse
Terry McKee
Ranch Hand
Joined: Sep 29, 2000
Posts: 173
posted
0
It isn't a problem to distribute the stub with the client if I can't do it dynamically with an FTP server. However, I am still running in to a problem when the stub is on the client but not in the default package. For instance, let's say I have the following on the client: c:\rmitest\HelloClient.class c:\rmitest\HelloInterface.class c:\rmitest\HelloImpl_Stub.class where all of the class files are in the default package - no package statement used - this works. The same classes - recompiled with package statements - does not work. I receive an error saying that the stub file can't be located. c:\rmitest\rmi\HelloClient.class c:\rmitest\rmi\HelloInterface.class c:\rmitest\rmi\HelloImpl_Stub.class The root directory here is rmitest and all of the classes should be in the rmi package. Do I have to set any properties to let the interpreter know where the stub class is? Thanks for the help in advance.
Fredrik Safstrom
Greenhorn
Joined: May 15, 2001
Posts: 20
posted
0
Terry, I had the same problem when I didn't regenerated the stub after setting the package to RMI in my client and server files... Did you re-generate the stub after setting package to RMI ??? /Bamse
Terry McKee
Ranch Hand
Joined: Sep 29, 2000
Posts: 173
posted
0
I did regenerate the stub using the following command: rmic -v1.2 rmi.HelloClient After researching further...Sun's site says that it is fine to download the stub dynamically from the server using ftp or a web server. It actually recommends that the client have no knowledge of where it is getting the stub so that it is more flexible. At this point I would like either design to work. Any other thoughts about why it works in the default package and not in anything else?
Terry McKee
Ranch Hand
Joined: Sep 29, 2000
Posts: 173
posted
0
I believe the source of the problem to be with the binding of my controller to the registry. I can bind it using the file protocol, but obviously this won't help the client. Sun's site says ftp protocol is available, but when I try using it - I can't bind the controller to the registry. Here are the two commands: Works - but client doesn't have access: java -Djava.rmi.server.codebase=file:///home/appdev/tmckee/dfsServer/lib/dfsServer/controllers/order/ OrderRegistar & Doesn't work: java -Djava.rmi.server.codebase=ftp://10.80.62.30/home/appdev/tmckee/dfsServer/lib/dfsServer/controllers/order/ OrderRegistrar & Help!!!