Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gmmastros on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Another RMI AccessControlException

Status
Not open for further replies.

Xemnosyst

Programmer
Dec 5, 2003
2
0
0
US
I saw the post earlier about the java.security.AccessControlException in correlation with RMI. I'm having the same problem, except the fixes mentioned in that thread didn't work.

Right now I'm just trying to get a very simple RMI example from SUN's tutorial website to work. I start the registry, then try to execute the "server" using:

java -Djava.rmi.server.codebase=file://~/research/rmi_tutorial -Djava.rmi.server.hostname=localhost -Djava.security.policy=~/research/java.all.policy engine.ComputeEngine


The policy file contains:
grant{
permission java.security.AllPermission;
};


And the error I get contains:
ComputeEngine exception: access denied (java.net.SocketPermission 127.0.0.1:1099 connect,resolve)
java.security.AccessControlException: access denied (java.net.SocketPermission 127.0.0.1:1099 connect,resolve)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:269)


If you can solve my problem, I will love you!

Thanks,
Eric
 
If I remember correctly, the default entry in the policy file allows the localhost (127.0.0.1) to listen on all ports, but not connect. There should be a line in the policy file (near the top) which reads
Code:
permission java.net.SocketPermission "localhost:1024-", "listen";
[code]
You need to add connect & resolve permissions, so change it so it reads
[code]
permission java.net.SocketPermission "localhost:1024-", "listen,connect,accept,resolve";
[code]
Greg.
 
Thank you for the tip, Greg. I'm not sure exactly what fixed it, but you got me started in the right direction. It seems as though using the .java.policy file, instead of trying to specify policy files on the command line, helped.

Now I've run into another problem, but I'll start a new thread for that if I need to.

Thanks again!

Eric

---
I pray that you may be active in sharing your faith, so that you will have a full understanding of every good thing we have in Christ.

Philemon 1:6 (NIV)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top