Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

FilePermissionException on UNIX

 
christy smile
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, all,
I get a java.io.FilePermission exception while writing to or reading to db.db file. This exception only occurs when running on UNIX platform, it works fine on Windows. In addition, the permission of the file is both readable and writable. The following is the stack trace for the exception.
Please help me with this, I have been debugging this for a while, and still have no clue what has caused the problem. Thank you!!!
RMIServerDBAdapter exception: access denied (java.io.FilePermission db.db write)
java.security.AccessControlException: access denied (java.io.FilePermission db.d
b write)
at java.security.AccessControlContext.checkPermission(AccessControlConte
xt.java:272)
at java.security.AccessController.checkPermission(AccessController.java:
399)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:545)
at java.lang.SecurityManager.checkWrite(SecurityManager.java:978)
at java.io.File.canWrite(File.java:527)
at jdev.db.Data.<init>(Unknown Source)
at jdev.server.RMIServerDBAdapter.<init>(Unknown Source)
at jdev.server.RMIServerDBAdapter.main(Unknown Source)
 
christy smile
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, All,
By the way, the policy file grants permission for everything! And it is really the AccessControlException caused by the FilePermission.
Thanks!
Christy
 
Sai Prasad
Ranch Hand
Posts: 560
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have
permission java.io.FilePermission
"/suncertify/db/db.db", "read,write";
in your java.policy file?
 
christy smile
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, sai,
Thank you for the reply. I had all permission granted originally. But I added the line you recommended, it still did not work . Any other suggestions?
Thanks.
Christy
 
Sai Prasad
Ranch Hand
Posts: 560
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suggest not using the RMI Security Manager and the java.policy file. You can also check to see whether db.db has write permission from the Unix point of view?
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You probably have this problem on the RMISecurityManager on the Server side.
Do as Sai says and just don't use RMISecurity or policy files.
Mark
 
christy smile
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Sai, Mark,
I thought the problem might be related to the RMISecurityManager. You are confusing me now. I am using RMI to implement the remote connection, doesn't that mean I have to use RMISecurityManager and policy file?? Is there anyway around it? Thank you!
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
doesn't that mean I have to use RMISecurityManager and policy file?? Is there anyway around it? Thank you!

No, actually you don't have to use it at all.
I actually only used it on the client side. I had tried on the server side, but I got errors, so I removed it. I figured it would be the client that would be rogue anyway, if there was problems.
But there are some who didn't have it at all and did not lose points because of it.
Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic