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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RMI: AccessControlException: access denied 1

Status
Not open for further replies.

TheMillionDollarMan

Programmer
Jun 10, 2002
132
US

Help.
Win 2k, Java SDK 2.

I am trying to run an example from SUN but failing. When I try to invoke the server I get the error message below. I get this error even if my host computer name is not correct.

Can anyone offer me some advice?

Thanks
D

Registry created on host computer DBrownFe on port 10002
Remote HelloService implementation object created
Exception in thread "main" java.security.AccessControlException: access denied (
java.net.SocketPermission DBrownFe resolve)
 
In JAVA_HOME\jre\lib\security there is a file called "java.policy". This controls permissions of the JVM at Runtime. I think the reason why you cannot invoke your server is beacause you are not allowed to resolve Socket/URL's according to this policy.

Try adding a line in this file on the global grant section :

permission java.net.SocketPermission "localhost:1024-", "listen,connect,resolve,accept";

 
THANKS!

You have at least started me in the right direction.
I saw an entry in the fileyou mentioned already. However I couldn't get your suggestion to work...

Now I can start the server without any problems (before i wasn't possible).

The only problem I have now is that the client can't get permission to use the server (contact is made yet SocketPermission is denied).

checkCreateClassLoader()
java.security.AccessControlException: access denied (java.net.SocketPermission 123.123.123.123:10027 accept,resolve)
at java.security.AccessControlContext.checkPermission(AccessControlConte
xt.java:269)
etc ....
 
Try adding in you java.policy file the below :

Code:
grant codeBase "file:C:/where_my/java_rmi/classes_live/*" {
permission java.security.AllPermission;
};

and also do the same on the client ... come back if it still doesn't work !
 

hey!!

You are the best.

I saw an entry in the java.policy like the one youi mentioned above only it was pointing to $JAVA_HOME\lib\ext.

Your suggestion worked.
Now I can leave this line of code in the example given:

System.setSecurityManager( new RMIServerSecurityManager() );


Thanks again!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top