This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with binding...

 
Sean Keane
Ranch Hand
Posts: 582
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?


 
Edward Harned
Ranch Hand
Posts: 291
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Sean Keane
Ranch Hand
Posts: 582
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 291
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic