• 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

Tomcat Permissions - java.io.FileNotFoundException Permission denied

 
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 28226
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 27808
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Hey, check out my mega multi devastator cannon. It's wicked. It makes this tiny ad look weak:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic