I have a question to the following scenario: I wrote a client and a server which share two common projects and communicate with RMI and only run locally in the stage I am right now. In the server.policy file i write:
grant codeBase "file:C:/webui/client/bin/开发者_C百科-" {
permission java.security.AllPermission;
};
grant codeBase "file:C:/webui/common1/bin/-" {
permission java.security.AllPermission;
};
grant codeBase "file:C:/webui/common2/bin/-" {
permission java.security.AllPermission;
};
For the client I tried grant codeBase "file:C:/webui/client/bin/-" { permission java.security.AllPermission; };
grant codeBase "file:C:/webui/common1/bin/-" {
permission java.security.AllPermission;
};
grant codeBase "file:C:/webui/common2/bin/-" {
permission java.security.AllPermission;
};
grant codeBase "file:C:/webui/server/bin/-" {
permission java.security.AllPermission;
};
but I get AccessDenied with cryptic messages like (org.osgi.framework.ServicePermission (service.id=37) get) and (fava.io.FilePermission C:\workspaces\webui.metadata.plugins\org.eclipse.pde.core\webui\1310480250513.log read). It works if I grant everything on the client side.
I do not know why, but it is possible that I did not fully understand the concept of .policy files.. ;)
Run the JVMs with -Djava.security.debug=access,failure. The output will show you what permissions are required by which security domains (i.e., essentially, codebases).
精彩评论