Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

RMI Exceptions

 
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 175
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 175
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 175
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!!!
 
Get me the mayor's office! I need to tell her about this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic