Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Error When Writing Text to Unix File  RSS feed

 
Jim Ball
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For my program I need to write the current time to a timestampfile for retrieval at a later time. My code works fine on the Windows side of things, but when I deploy it to the Unix server (with the needed path alterations) it does not work. The error I receive is below:

FATAL : 01.15.2007:1234 (28.751) [main] BatchProcess: access denied (java.io.FilePermission /appl/tawb1/interface/config/timestampfile write)
java.security.AccessControlException: access denied (java.io.FilePermission /appl/tawb1/interface/config/timestampfile write)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java(Compiled Code))
at java.security.AccessController.checkPermission(AccessController.java(Compiled Code))
at java.lang.SecurityManager.checkPermission(SecurityManager.java(Compiled Code))
at java.lang.SecurityManager.checkWrite(SecurityManager.java:998)

The code that I am using to write to the file is the following:
BufferedWriter out = new BufferedWriter(new FileWriter(rMgr.get("time.stamp.file.path") + "timestampfile"));
out.write(currentTime);
out.newLine();
out.close();

The path is valid, I do have the needed access to write to the timestampfile, and I can read from the file without an issue. Could the problem be with SecurityManager in Java? Any assistance to point me in the right direction would be greatly appreciated.

Thanks,

Jim
 
Joe Ess
Bartender
Posts: 9425
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is this a plain Java app or a web application?
If it is a web application, the container probably has a security policy in place to prevent unscrupulous or stupid applications from going crazy on the file system. You will need to consult your application server documentation to identify where to modify the security policy.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!