GeeCON Prague 2014*
The moose likes Distributed Java and the fly likes Problem with binding... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Distributed Java
Bookmark "Problem with binding..." Watch "Problem with binding..." New topic
Author

Problem with binding...

Sean Keane
Ranch Hand

Joined: Nov 03, 2010
Posts: 581

Hi, I am new to RMI and just playing around with a toy example, but I am having problems! So wondering if anyone can steer me in the right direction?

I am following an example from the book Core Java, Vol. 2: Advanced Features 8th Edition (page 849) http://www.amazon.com/Core-Java-Vol-Advanced-Features/dp/0132354799/ref=sr_1_1?ie=UTF8&qid=1298533409&sr=8-1

The code is quite simple, I am just trying to start up the server, here's the code:



But when I try this, I get the error below. I have turned off Windows firewall. I understand when you don't specify a URL or port that the localhost will be used and port 1099 - I've checked that port 1099 is not in use, and my IP address is indeed 172.16.160.17 as per the error message. So I'm a bit unsure of how to resolve this issue. Any ideas?



SCJP (1.4 | 5.0), OCJP (6.0), OCMJD
Edward Harned
Ranch Hand

Joined: Sep 19, 2005
Posts: 291

You need a security policy file such as:
grant {
permission java.security.AllPermission "", "";
};

You'll also need a classpath so the RMI Registry can find your generated stub.


Ed's latest article: A Java Parallel Calamity http://coopsoft.com/ar/Calamity2Article.html
Sean Keane
Ranch Hand

Joined: Nov 03, 2010
Posts: 581

Thanks. I created a file called security.policy in the same folder as my .class file that contained:



I then ran the following command



and got the exact same error, any suggestions?
Edward Harned
Ranch Hand

Joined: Sep 19, 2005
Posts: 291

It still looks like a security problem.

The registry also needs a security policy file as well as a classpath. The registry is realty a Java application too.
-J-Djava.security.policy=
-J-Dclasspath=

These problems happen to everyone. Once you get everything set up, it will all work fine.
 
GeeCON Prague 2014
 
subject: Problem with binding...