Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

java.io.FilePermission

843793Jul 19 2001 — edited Oct 14 2008
I am baffled by a security.AccessControlException that I get when I try to start an RMI server.

The server sets an RMISecurityManager(), then creates an engine that extends UnicastRemoteObject and attempts to bind it (on localhost) with Naming.rebind(...). There it fails:

RemoteCalcServer exception: access denied (java.io.FilePermission \\C\Projects\OmegaClient\classes read)
java.security.AccessControlException: access denied (java.io.FilePermission \\C\Projects\OmegaClient\classes read)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:245)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:220)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:354)
at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
at java.rmi.Naming.rebind(Naming.java:160)
at com.tibotec.isclient.calc.server.RemoteCalcServer.main(RemoteCalcServer.java:52)


The policy file is:

grant codeBase "file://C:/Projects/OmegaClient/classes/-" {
permission java.io.FilePermission "\\C\\Projects\\OmegaClient\\classes\\", "read";
permission java.net.SocketPermission "localhost:1024-", "listen, accept, connect";
};

It must be correctly loaded and used, because a (different) exception is generated when I comment out the SocketPermission. But why does RMI complain about not having reading permission on that directory (the codeBase, and its value must be correct, or else I should get ClassNotFound exceptions)?

I have tried every almost imaginable change to the directory syntax, including including "C:\\-", "file://C:/-", and "<<ALL FILES>>" but those don't help...

Emmanuel


Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 11 2008
Added on Jul 19 2001
22 comments
4,490 views