• 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 ...
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Pemission Denied on file creation when running JBoss AS as a *nix service  RSS feed

Posts: 25
Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Main Issue

I have successfully set up a JBoss staging server to be run as a linux service (Debian distribution and more specifically A Linux Mint 15).

When I run the service (not with root profile = no `sudo`):

every thing works fine except for a module where I used to create a file to write in some report stuff and seems like the file creation is denied because of permission limitations.

My sources for the code where I create a new `File` are as follows:

It is quite clear that my issue is risen due to use of the AccessController but lets say that this is a security restriction and a I need to have work as is.

What I tried to bypass this Security restriction

* I have set the *jboss-user* to be owner of the jboss service script:

* After some debugging sessions, I realized that initially the reportFile was created under the root folder ("/"), so I managed to initialize the user.dir system property and set it up to a directory path (/report) under jboss-user home directory (to make sure the user have read/write permissions):

* I have added a SecurityManager and declared a security policy file:

The /home/jboss-user/.java.policy has below content, (all permissions are granted):

* Checked that "home/jboss-user/report" directory where my file is supposed to go in has read/write permissions set to all users.

After applying all above tricks, I still cannot have my file created and I still stack with a:

I have also tried to play with directory permissions, jboss service script owner, the java policy rules but none of there has made the line.

One more addendum that I should point id that there is no issue when running the JBoss AS basically from the start script and I can have my file successfully created.

Any help would be greatly appreciated.
Posts: 10445
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Marwen, welcome to CodeRanch!

Please post the entire exception stacktrace that you are seeing. That is going to help us understand what might be wrong.
Marwen Trabelsi
Posts: 25
Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Many thanks @Jaikiran Pai
Here is the full trace of the thrown exception, noting that I update my code to catch an Exception instance instead of PrivilegedActionException since the later does not let get the whole cause:

A wop bop a lu bob a womp bam boom. Tutti frutti ad:
ScroogeXHTML - small and flexible RTF to HTML converter library
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!