• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

Tomcat Permissions - java.io.FileNotFoundException Permission denied

 
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've got a problem writing a pdf file to a folder. Part of my work already has PHP reading and writing to this folder. The folders read/write permissions are set correctly

But i can't write to it with my jsp application.

I understand there are SecurityManager Permission classes applicable to Tomcat such as: java.io.FilePermission each controls read/write/execute access to files and directories.

In tomcat 5.5 - i have a catalina.policy file, but i don't know how to grant permission to read/write to that folder

I added this to the catalina.policy file under _ web application permissions _ , but it doesn't work.






ERROR
 
Marshal
Posts: 25949
69
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

jite eghagha wrote:I've got a problem writing a pdf file to a folder. Part of my work already has PHP reading and writing to this folder. The folders read/write permissions are set correctly

But i can't write to it with my jsp application.



Then that suggests to me that the two applications might be running under different user profiles. Check out whether your so-called "correct" permissions work the same for both profiles.
 
jite eghagha
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, they are both in two different profiles - the PHP doesn't run in Tomcat. The jsp is running on Tomcat 5.5 i installed on the Godaddy VPS.

I can read files in the folder.


causes this error......java.io.FileNotFoundException: /home/admin/public_html/sandbox/server/applicantForms/164287384763216/GENLABOUT.pdf (Permission denied)



 
Ranch Hand
Posts: 121
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's not a JVM-level permission, it's an OS-level permission. You cannot fix with problem with SecurityManager configuration. You should modify OS-level permissions for that directory or run both applications using same system account. Just for test calling "chmod +w <directory>" should fix the problem (you may also need to set write permission on individual files). Note that "read permission" and "write perimission" are not a same permission. So it is possible that some account can read directory but can't write into it.
 
Saloon Keeper
Posts: 22658
153
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Typically, an Apache (PHP) web server will run under one userID, such as "apache" and the Tomcat web server will run under a userID of its own, such as "tomcat".

In order for both users to be able to write, both userids would have to be in a write-enabled protection group for that particular directory.
 
Thank you my well lotioned goddess! Here, have my favorite tiny ad!
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic