• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Locating rmi registry over the network

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everybody.
I am building a RMI Application but I am having some problems, locating the RMI registry, which I start with my server.
I know I will only have that server running in that machine (and only one RMI server), so the code looks like this:

In the future I am to replace the "1100" for a parameter, probably read from a properties file.
My server class will be running in a machine named PANORAMIX, inside the local area network.
My clients, which will be run on machines named like ASTERIX, OBELIX, IDEAFIX, ... need to get the RMI registry that I create when I start my server. The code I am using in the clients is:

The parameters, are again to be replaced by values read from properties file.
I am running the clients with

which has the following content

When I had the clients and the server both running in the same machine, ie, the security file had only one SocketPermission line: java.net.SocketPermission "127.0.0.1", "accept, connect, listen, resolve";
and I used LocateRegistry with "127.0.0.1", everything worked fine. Now that I have put them to run on different machines, I can no longer get to the RMI registry from the clients.
The exception text is "refused to connect".
Any help concerning this would be most appreciated.
Thank you.
 
Ranch Hand
Posts: 388
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi
your policy file does not seem to be correct.
the word "permission" is missing for ASTERIX, OBELIX, IDEAFIX.
perhaps this prevents the file to be read correctly ?
since you still have the "permission java.security.AllPermission;" in your file you should not have any problem at all so i guess either your policy file is either not in the good place, incorrect or you do not load it correctly.
k
 
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
in your code
LocateRegistry.getRegistry().rebind("workServer", server);
is looking for RMI registry on a default port (1099), while you create it on 1100 port. Statement that you have only one registry on your PC is not correct, LocateRegistry is not going to scan all possible ports on your machine to try to see which is being listened by registry.
 
Ricardo Marques
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the suggestions. I have found the solution some time ago, but still hadn't had the time to thank you.
Thank you.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic