[Solved] Java.nio.file.AccessDeniedException is reported when moving excel files in Tomcat project

The company has a requirement to read excel on a regular basis to obtain the BOM structure. After reading it, the excel file needs to be moved to another folder.

1. When using the Files.move(source, target, options) method, the error is reported as follows
java.nio.file.AccessDeniedException: D:\DBdate\MID\DOC\PT038\20210726\CXDA-20016-0010 pack-410x180x180.xlsx -> D:\DBdate\MID\DOC\readedexcel\CXDA-20016-0010 pack-410x180x180.xlsx
It should be caused by Tomcat not having file delete permissions

2. Solution: Set the Tomcat service to log in with the local system account

Similar Posts:

Leave a Reply

Your email address will not be published. Required fields are marked *