This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Grokking Bitcoin and have Kalle Rosenbaum on-line!
See this thread for details.
Win a copy of Grokking Bitcoin this week in the Cloud/Virtualization forum!
  • 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
  • Liutauras Vilda
  • Bear Bibeault
  • Tim Cooke
  • Junilu Lacar
  • Paul Clapham
  • Devaka Cooray
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Frits Walraven
  • Carey Brown
  • salvin francis
  • Claude Moore

unix/ias/java help  RSS feed

Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone help me with the problem below
I have a small java application that takes image data from a d/b and formats it as a bmp to write to a directory on a unix box to be used by other applications. (for reporting etc). This runs via the oracle 9ias application server.
The original version of this app only provided an image in png format for display on screen (for reports etc) but we have since found that some reports for external customers required the image as a saved version on the file system.
To this end I produced a new version of the image retriever that now produces the image for report display and writes a .bmp version of the image to the file system for use by external reports etc.
The problem I'm having is that when the bmp is created it is only has permissions for user and group to read (e.g. -rw-r-----). The external reports are run using another user id which then does not have permissions to read the file.
The first thing I tried was to change the umask for the user running ias so that files created by that user have default permissions with read access for all users, however this did not work and the permission remained as that above.
I have also tried changing the java code to override default permissions using FilePermission, this works in that you can change the permissions of the file being created but only for the user and group part of the permission (e.g. -rwxrwx---)
I am not sure whether these default permissions are caused by
a) the Unix environment for the ias user
b) 9ias itself
c) something I am missing in the java code
Any help would be gratefully recieved.
Chicken Farmer ()
Posts: 1932
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm going to pass this to the Unix/Linux forum, hopefully someone there has seen this issue and can you help you with the problem.
Saloon Keeper
Posts: 20643
Android Eclipse IDE Java Linux Redhat Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yep, Odds are that the file's being created owned by the appserver and with limited rights for security purposes. I don't think access rights are portable enough to be part of Java, so you'll have to do some external magic.
The simplest way is to simply add the consumers to the group under which the file is produced. This is clean, requires no programming, and in harmony with how Unix/Linux file access rights are intended to be used.
However, if the list of consumers is large and/or fluid, more extreme measures may be called for. The next easiest way would be to invoke runtime.exec to execute the chmod shell command.
Finally, you may be able to find a JNI package that manages file rights for you. This will be less portable, but probably less overhead.
You can also do some variants, if they fit well, such as making the images downloadable via HTTP or FTP.
What's that smell? I think this tiny ad may have stepped in something.
ScroogeXHTML - the small and fast RTF to HTML converter library
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!