title: AccessDeniedException When Moving Files on NAS
body: <p>I'm having trouble solving a permissions issue with my Java Servlet running on Tomcat 6.0</p>
  
  <p>I encounter an AccessDeniedException when I try to manipulate files stored on a Network Share.</p>
  
  <p>Here is the stack trace:</p>
  
  <pre><code>java.nio.file.AccessDeniedException: \\192.168.1.150\san\input\picture.jpg -&gt; \\192.168.1.150\san\output\picture.jpg
      at sun.nio.fs.WindowsException.translateToIOException(Unknown Source)
      at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
      at sun.nio.fs.WindowsFileCopy.move(Unknown Source)
      at sun.nio.fs.WindowsFileSystemProvider.move(Unknown Source)
      at java.nio.file.Files.move(Unknown Source)
      at com.package.Task.MoveFile.exec(MoveFile.java:33)
      at com.package.Task.PostProcess.doPost(Download.java:101)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
      at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:877)
      at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:594)
      at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1675)
      at java.lang.Thread.run(Unknown Source)
  </code></pre>
  
  <p>After researching posts on StackOverflow, I'm unable to find a solution that matches my situation.  </p>
  
  <p>A few things to note:</p>
  
  <ul>
  <li><p>I only experience this issue with my deployed application (war file in webapps directory of Tomcat 6 server).</p></li>
  <li><p>No access problems when running the application within Eclipse Tomcat server.</p></li>
  <li><p>Windows permissions on Network Share appear correct (User = Everyone, Permission = Full Control).</p></li>
  <li><p>The files are located on a Network Share and physically reside on a SAN.</p></li>
  <li><p>No permissions issues when manipulating the same files on a standalone Java application.</p></li>
  </ul>
  
  <p>One of the lines of code that draws this exception is:</p>
  
  <pre><code>Files.move(source, target, StandardCopyOption.ATOMIC_MOVE);
  </code></pre>
  
  <p>I've confirmed that the Paths being passed to this function are correct and the files do exist.</p>
  
  <p>I'm not sure what else to do at this point and any help would be greatly appreciated.</p>