• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

policy file

 
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am having problems starting up my server. I am using RMISecurityManager and I have gathered that you must define a policy file. I've set mine:

grant {
permission java.security.AllPermissions;
};
and saved it as policy. Its in my project directory, specifically: "C:\My Java\suncertify\db"
now i've set my classpath=.;c:\my java
Question is, what is the proper parameters to run my server specifying the policy file I've just defined? is it something along the path of
"java -Djava.security.policy="C:\My Java\suncertify\db\policy" suncertify.db.<server's class name> ?? i've tried and it didn't work... still giving me AccessException. anyone knows anything about this??
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That happens to everyone. I have not seen a post here yet that states them getting the RMISecurity manager with the policy file to work on the server. I ended up only having it on the client.
Mark
 
Hung Tang
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
mark, I seemed to got it to work when I was learning RMI the first time. Hmm... the sample program that I used to test RMI is at work, so I will go there to find what I've done to make it successful. But I guess I should take out RMISecurityManager for the server, if it doesn't violate anything (design issues??) Now I got another issue with db.db not being accessible or that it maybe non-existant when I run my server. Would you know the problem to this?
 
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Mark,
Hi Mark,
After reading some tutorial on RMI, i've decided to have the RMI security manager created on both client and server side like this:
System.setSecurityManager(new RMISecurityManager());
And i'm still getting the same error when i run the server.
access denied (java.io.FilePermission java.security.AccessControlException: access denied (java.io.FilePermission db.db write)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkWrite(Unknown Source)
at java.io.File.canWrite(Unknown Source)
Do you think this error could be bcos of the db.db file?? (...and not bcos of RMI security manager) do you think db.db is inaccessible? If so what could be the reason, as such my scjd.policy file grants ALL permission.
Thanks,
Sri
 
Hung Tang
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sri, i fixed my problem and I could tell you the error your getting should be related to the policy file. Make sure you have set it grant all permissions and run it with the correct parameters. ie.
java -Djava.security.policy="<path of policy file>" suncertify.db.<server app>
that should do it. Make sure you got the stubs created and rmiregistry started. If there's an error with db.db not being accessible, the problem lies in the server's class. You have to specify the FILE to be opened as a path. ie.
Data d = new Data("C:\\suncertify\\db\\db.db");
Well, this is what I did and it seemed to work.. Hopefully this will answer some of your questions.
 
Did you just should on me? You should read this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic