Search code examples
javapermissionsplayframeworkniojava-7

Getting FileSystemException "A required privilege is not held by the client" using Files.createSymbolicLink in Play Framework


I'm trying to use the new Java 7 Files.createSymbolicLink() method within Play! Framework, and I got the following exception:

RuntimeException occured : java.nio.file.FileSystemException: c:\work\foo\bar:
A required privilege is not held by the client.

This is my first encounter with Java's permission model, so I understand what's going on, but don't yet know how to fix it (I'd like to give the Controllers more permissions).

If anyone can answer here faster than I'll find the answer, me (and future readers) will be grateful.


Solution

  • This isn't a problem with java permissions, but a problem with the operating system permissions. See FileSystemException.

    The subclasses of FileSystemException are: AccessDeniedException, AtomicMoveNotSupportedException, DirectoryNotEmptyException, FileAlreadyExistsException, FileSystemLoopException, NoSuchFileException, NotDirectoryException, NotLinkException.

    From AccessDeniedException:

    Checked exception thrown when a file system operation is denied, typically due to a file permission or other access check. This exception is not related to the AccessControlException or SecurityException thrown by access controllers or security managers when access to a file is denied.