• Post Reply Bookmark Topic Watch Topic
  • New Topic

rmi registry ip address question

 
Terence Doyle
Ranch Hand
Posts: 328
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm new to rmi and I'm trying to get an example from a book working.
I can start the registry and register the remote object correctly.
However when I try to start the client I get this error:

I have put in a .policy file in the working directory.
Can anyone shed a little light on this problem which I'm sure is a common one for rmi newbies like myself?

Thanks,
Terry
 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Terry -
Some points to consider:
- Make sure you are connected to the network when running this code. Several versions of Windows don't load their TCP/IP stack unless they sense they're on a network.
- Is rmiregistry running in its own directory? Can it "see" the remote stub in its CLASSPATH? I'm sure your book mentions that.
- Does your client code install a Security Manager? If not, it won't accept incoming code from anyone. That's built into the Java 2 VM.
------------------
Michael Ernest, co-author of: The Complete Java 2 Certification Study Guide
 
Terence Doyle
Ranch Hand
Posts: 328
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for answering Michael.
[ and thanks for writing that great book which got me certified ]
I'm connected to a network, the classfiles are all in a directory that is in the classpath, and the rmiregistry can definitely see the stub - here's the output from the class that registers my server object:

I'm not sure if the problem is the ip address and port number because the client gets an error that mentions a different ip address and port number...

The example in the book doesn't mention any way to set the port for this first example.
The port used by the registry is the IP I have assigned for my adsl connection and the client is trying to use the localhost address.
The example is from Java Server Programming J2EE Edition Chapter 2 pg 46-49
Do you have any more suggestions?
Many thanks,
Terry
 
Terence Doyle
Ranch Hand
Posts: 328
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I got it working by commenting out the line in the client that set the security manager.
Why would that be?
Terry
 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Port 1099 is one rmiregistry is using. You can change the port (if you want) with:
C:\> rmiregistry < alt_port_num >
Make sure of course the client is made aware of the change.
Probably in your Naming.lookup() call you're addressing the machine by its local name, and that's resolving to localhost (127.0.0.1). Try the online IP address as a string; your ISP doesn't assign a canonical name to that address, so it'll have to do.
------------------
Michael Ernest, co-author of: The Complete Java 2 Certification Study Guide
[This message has been edited by Michael Ernest (edited January 01, 2002).]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!