• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Access denied(java.io.FilePermission db.db write)

 
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
trying to start my server
Access denied(java.io.FilePermission db.db write)
java -Djava.security.policy=myPermit.policy suncertify.server.flyServer db.db
help Lisa
 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
so, what was in the myPermit.policy file.
Also what directory was it in? What was the current directory?
Is there a way to determine the policy file from the java code?
------------------
--glenn
[This message has been edited by Glenn Opdycke-Hansen (edited May 18, 2001).]
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Lisa, what does your policy file say ?
 
Lisa Foster
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
here is my policy any help greatly appreciated

grant
{
permission java.security.AllPermissions;
permission java.net.SocketPermission"*:1024-65535","connect,accept,resolve";
permission java.net.SocketPermission"*:1-1023","connect,resolve";
};
Thanks Lisa
 
Ranch Hand
Posts: 334
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
grant
{
permission java.security.AllPermissions;
permission java.net.SocketPermission"*:1024-65535","connect,accept,resolve";
permission java.net.SocketPermission"*:1-1023","connect,resolve";
"c://project//suncertify//db//db.db", "read,write";
};
 
ruilin yang
Ranch Hand
Posts: 334
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please discard the last message. Sorry I missed one line Here is correct format. You need to edit the file directory according to your directory structure.
grant
{
permission java.security.AllPermissions;
permission java.net.SocketPermission"*:1024-65535","connect,accept,resolve";
permission java.net.SocketPermission"*:1-1023","connect,resolve";
permission java.io.FilePermission
"c://project//suncertify//db//db.db", "read,write";
};
 
Glenn Opdycke-Hansen
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why not start with a simple policy file?
I thought it was important to document how to specify a policy file. I did not know that it was required to have a policy file that was appropriate for a production system.
The following file worked for me.
grant {
// Allow everything for now
permission java.security.AllPermission;
};
 
Lisa Foster
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks very much got it working just have to fix the classCast Exception

Thanks Lisa
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
I have a similar problem. I have an applet reading a txt file and then plotting a graph. The text file and the applet class files are in the same directory. when i run on my local machine, it runs fine, and the graphs come up, but when i try to access from some other machine, then the console pops up an
java.security.AccessControlException: access denied (java.io.FilePermission \\C\vj\rxhast\Chart2D_1.3.0\net\sourceforge\chart2d\mydata.txt read)
any help would be appreciated.
Vj
 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

TheStud,

Your problem is pretty direct. On your local machine your text file is probably located in the same location as you applet (or has default policy file set to AllPermissions) so you won't have any problem.

When you try it from another machine its another case altogether. We all know how Java prides itself on being a secure platform such that malicious code cannot take advantage of the system running the Java app. As such the applet is not given the permissions to run amok and go thru the files on your machine or your network.

To resolve this you have to explicitly set permissions giving permission to the VM under which the applet is running OR alternatively you can sign the applet, in which case the browser should allow the applet to access the file.

But I think the best solution would be to use ONLY the file name ('mydata.txt') without the extension when trying to open/access the file. That way if the file is in the same directory as the applet the applet will be able to open/access the file without any need for the above security details. I think this would preferred.

Let me know it this helps.

Akanimo.

P.S. - Better change your username to your own name (or alias) before the bartenders/sheriff get on your case
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic